Index: main.cc |
diff --git a/main.cc b/main.cc |
index 3ae1e4bec40b1e089e12e310918301d3c34ca92c..f449fa401ece16536a0f9377eae0fe6ace3daa5a 100644 |
--- a/main.cc |
+++ b/main.cc |
@@ -11,10 +11,12 @@ |
#include "base/command_line.h" |
#include "base/logging.h" |
+#include "base/string_util.h" |
#include "metrics/metrics_library.h" |
#include "update_engine/dbus_constants.h" |
#include "update_engine/dbus_service.h" |
#include "update_engine/prefs.h" |
+#include "update_engine/subprocess.h" |
#include "update_engine/update_attempter.h" |
#include "update_engine/utils.h" |
@@ -33,6 +35,14 @@ using std::vector; |
namespace chromeos_update_engine { |
+gboolean UpdateBootFlags(void* arg) { |
+ // This purely best effort. Failures should be logged by Subprocess. |
+ int unused = 0; |
+ vector<string> cmd(1, "/usr/sbin/chromeos-setgoodkernel"); |
+ Subprocess::SynchronousExec(cmd, &unused); |
+ return FALSE; // Don't call this callback again |
+} |
+ |
namespace { |
gboolean UpdateOnce(void* arg) { |
@@ -147,6 +157,9 @@ int main(int argc, char** argv) { |
chromeos_update_engine::SchedulePeriodicUpdateChecks(&update_attempter); |
+ // Update boot flags after 45 seconds |
+ g_timeout_add_seconds(45, &chromeos_update_engine::UpdateBootFlags, NULL); |
+ |
// Run the main loop until exit time: |
g_main_loop_run(loop); |