blob: 20b33b360d7b994a4a0fa9f2e104523a7a5402d7 [file] [log] [blame]
#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, mode, "post_install",
"The mode of the installer. Can be `post_install` or "
"`activation_check`");
namespace {
using ::bloom_install::ActivationMain;
using ::bloom_install::PostInstallMain;
} // 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") {
LOG(ERROR) << "Invalid mode: " << mode;
return 1;
}
if (mode == "activation_check") {
return ActivationMain(absl::GetFlag(FLAGS_activation_check_dir));
}
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));
}