blob: 7ee1560f06ec4c3260cf3e3601cd772ba8263c61 [file] [log] [blame] [edit]
#include <string>
#include "absl/flags/flag.h"
#include "absl/flags/parse.h"
#include "absl/log/log.h"
#include "install/installer.h"
ABSL_FLAG(std::string, inventory_dir, "/run/install/inventory",
"Directory where firmware inventory is stored.");
ABSL_FLAG(std::string, install_lock_file, "/run/install/install_ongoing",
"Lock file to indicate an installation is in progress.");
ABSL_FLAG(std::string, bundle_tar_file,
"/mnt/luks-mmcblk0_fs/firmware_bundle.tar.gz",
"File path where firmware bundle gets stored by Redfish update. The "
"untarred files will be stored in the same directory under "
"`firmware_bundle` folder.");
ABSL_FLAG(std::string, activation_check_dir, "/var/google/firmware_bundle/",
"Directory where activation check scripts are persisted.");
ABSL_FLAG(std::string, public_key_file, "",
"File path for the public key used to verify the firmware bundle.");
ABSL_FLAG(std::string, mode, "post_install",
"The mode of the installer. Can be `post_install` or "
"`activation_check`");
namespace {
using ::bloom_install::ActivationMain;
using ::bloom_install::PostInstallMain;
using ::bloom_install::SignatureCheckMain;
} // namespace
int main(int argc, char* argv[]) {
absl::ParseCommandLine(argc, argv);
std::string mode = absl::GetFlag(FLAGS_mode);
if (mode != "post_install" && mode != "activation_check" &&
mode != "signature_check") {
LOG(ERROR) << "Invalid mode: " << mode;
return 1;
}
if (mode == "activation_check") {
return ActivationMain(absl::GetFlag(FLAGS_activation_check_dir));
}
if (mode == "signature_check") {
return SignatureCheckMain(absl::GetFlag(FLAGS_bundle_tar_file),
absl::GetFlag(FLAGS_public_key_file));
}
return PostInstallMain(absl::GetFlag(FLAGS_inventory_dir),
absl::GetFlag(FLAGS_install_lock_file),
absl::GetFlag(FLAGS_bundle_tar_file),
absl::GetFlag(FLAGS_activation_check_dir),
absl::GetFlag(FLAGS_public_key_file));
}