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

Unified Diff: update_engine_client.cc

Issue 4181001: AU: Implement getting of tracks through GetTrack. (Closed) Base URL: http://git.chromium.org/git/update_engine.git
Patch Set: sort by names 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 20c86a5a12bce47f2c0d82de4f8c8dc734772249..c0b61feca620401d247b942e408df5deab06ca18 100644
--- a/update_engine_client.cc
+++ b/update_engine_client.cc
@@ -26,6 +26,7 @@ DEFINE_string(app_version, "", "Force the current app version.");
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(show_track, false, "Show the update track.");
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. "
@@ -192,6 +193,24 @@ void SetTrack(const string& track) {
LOG(INFO) << "Track permanently set to: " << track;
}
+string GetTrack() {
+ DBusGProxy* proxy;
+ GError* error = NULL;
+
+ CHECK(GetProxy(&proxy));
+
+ char* track = NULL;
+ gboolean rc =
+ org_chromium_UpdateEngineInterface_get_track(proxy,
+ &track,
+ &error);
+ CHECK_EQ(rc, true) << "Error getting the track: "
+ << GetGErrorMessage(error);
+ string output = track;
+ g_free(track);
+ return output;
+}
+
static gboolean CompleteUpdateSource(gpointer data) {
string current_op;
if (!GetStatus(&current_op) || current_op == "UPDATE_STATUS_IDLE") {
@@ -239,6 +258,11 @@ int main(int argc, char** argv) {
SetTrack(FLAGS_track);
}
+ // Show the track if requested.
+ if (FLAGS_show_track) {
+ LOG(INFO) << "Track: " << GetTrack();
+ }
+
// Initiate an update check, if necessary.
if (FLAGS_check_for_update ||
FLAGS_update ||
« 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