Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1103)

Unified Diff: update_attempter.cc

Issue 6881037: AU: Always run setgoodkernel, unless we abort within 45 seconds of launch. (Closed) Base URL: http://git.chromium.org/git/update_engine.git@master
Patch Set: Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « update_attempter.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: update_attempter.cc
diff --git a/update_attempter.cc b/update_attempter.cc
index f56c0d1275ffd3dca0aeb1e720b5ac59e342a3e4..e1ab0b171fe7afd97a062d1214e4d5609775b05f 100644
--- a/update_attempter.cc
+++ b/update_attempter.cc
@@ -28,6 +28,7 @@
#include "update_engine/omaha_response_handler_action.h"
#include "update_engine/postinstall_runner_action.h"
#include "update_engine/prefs_interface.h"
+#include "update_engine/subprocess.h"
#include "update_engine/update_check_scheduler.h"
using base::TimeDelta;
@@ -114,7 +115,8 @@ UpdateAttempter::UpdateAttempter(PrefsInterface* prefs,
is_full_update_(false),
proxy_manual_checks_(0),
obeying_proxies_(true),
- chrome_proxy_resolver_(dbus_iface) {
+ chrome_proxy_resolver_(dbus_iface),
+ updated_boot_flags_(false) {
if (utils::FileExists(kUpdateCompletedMarker))
status_ = UPDATE_STATUS_UPDATED_NEED_REBOOT;
}
@@ -127,6 +129,7 @@ void UpdateAttempter::Update(const std::string& app_version,
const std::string& omaha_url,
bool obey_proxies) {
chrome_proxy_resolver_.Init();
+ UpdateBootFlags(); // Just in case we didn't do this yet.
if (status_ == UPDATE_STATUS_UPDATED_NEED_REBOOT) {
LOG(INFO) << "Not updating b/c we already updated and we're waiting for "
<< "reboot";
@@ -451,6 +454,19 @@ bool UpdateAttempter::GetStatus(int64_t* last_checked_time,
return true;
}
+void UpdateAttempter::UpdateBootFlags() {
+ if (updated_boot_flags_) {
+ LOG(INFO) << "Already updated boot flags. Skipping.";
+ return;
+ }
+ // This is purely best effort. Failures should be logged by Subprocess.
+ int unused = 0;
+ vector<string> cmd(1, "/usr/sbin/chromeos-setgoodkernel");
+ Subprocess::SynchronousExec(cmd, &unused);
+ updated_boot_flags_ = true;
+ return;
+}
+
void UpdateAttempter::SetStatusAndNotify(UpdateStatus status) {
status_ = status;
if (update_check_scheduler_) {
« no previous file with comments | « update_attempter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698