Index: utils.cc |
diff --git a/utils.cc b/utils.cc |
index 95b5ec9ad785d8dbbb1b0a17ad8131cc3b73a065..7206171e89e4dd24534fb975fa9554931c217410 100644 |
--- a/utils.cc |
+++ b/utils.cc |
@@ -25,6 +25,7 @@ |
#include <base/rand_util.h> |
#include <base/string_util.h> |
#include <base/logging.h> |
+#include <cros_boot_mode/boot_mode.h> |
#include <rootdev/rootdev.h> |
#include "update_engine/file_writer.h" |
@@ -50,6 +51,15 @@ bool IsOOBEComplete() { |
return file_util::PathExists(FilePath(kOOBECompletedMarker)); |
} |
+bool IsNormalBootMode() { |
+ cros_boot_mode::BootMode mode; |
+ mode.Initialize(false, // unsupported_is_developer |
+ true); // use_bootloader |
+ bool normal = mode.mode() == cros_boot_mode::BootMode::kNormal; |
+ LOG_IF(INFO, !normal) << "Boot mode not normal: " << mode.mode_text(); |
+ return normal; |
+} |
+ |
bool WriteFile(const char* path, const char* data, int data_len) { |
DirectFileWriter writer; |
TEST_AND_RETURN_FALSE_ERRNO(0 == writer.Open(path, |