AU: call script to set boot flags on successful boot.
BUG=5655
TEST=Tested on device, saw script was run
Review URL: http://codereview.chromium.org/3117033
diff --git a/main.cc b/main.cc
index 3ae1e4b..f449fa4 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 @@
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 @@
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);