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

Unified Diff: update_engine_client.cc

Issue 4094001: AU: Provide a D-Bus API for changing the update track. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: review comments Created 10 years, 2 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_engine.xml ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: update_engine_client.cc
diff --git a/update_engine_client.cc b/update_engine_client.cc
index 7bbc62f6de5edfc38764409adabe60903260df85..a662242b4e66f89a973085a827768f5f8279881b 100644
--- a/update_engine_client.cc
+++ b/update_engine_client.cc
@@ -27,6 +27,7 @@ DEFINE_bool(check_for_update, false, "Initiate check for updates.");
DEFINE_string(omaha_url, "", "The URL of the Omaha update server.");
DEFINE_bool(reboot, false, "Initiate a reboot if needed.");
DEFINE_bool(status, false, "Print the status to stdout.");
+DEFINE_string(track, "", "Permanently change the update track.");
DEFINE_bool(update, false, "Forces an update and waits for its completion. "
"Exit status is 0 if the update succeeded, and 1 otherwise.");
DEFINE_bool(watch_for_updates, false,
@@ -176,6 +177,21 @@ bool RebootIfNeeded() {
return true;
}
+void SetTrack(const string& track) {
+ DBusGProxy* proxy;
+ GError* error = NULL;
+
+ CHECK(GetProxy(&proxy));
+
+ gboolean rc =
+ org_chromium_UpdateEngineInterface_set_track(proxy,
+ track.c_str(),
+ &error);
+ CHECK_EQ(rc, true) << "Error setting the track: "
+ << GetGErrorMessage(error);
+ LOG(INFO) << "TODO: Track permanently set to: " << track;
+}
+
static gboolean CompleteUpdateSource(gpointer data) {
string current_op;
if (!GetStatus(&current_op) || current_op == "UPDATE_STATUS_IDLE") {
@@ -218,6 +234,11 @@ int main(int argc, char** argv) {
return 0;
}
+ // First, update the track if requested.
+ if (!FLAGS_track.empty()) {
+ SetTrack(FLAGS_track);
+ }
+
// Initiate an update check, if necessary.
if (FLAGS_check_for_update ||
FLAGS_update ||
@@ -256,6 +277,6 @@ int main(int argc, char** argv) {
return 0;
}
- LOG(INFO) << "No flags specified. Exiting.";
+ LOG(INFO) << "Done.";
return 0;
}
« no previous file with comments | « update_engine.xml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698