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

Unified Diff: update_engine_client.cc

Issue 3048008: Add support to update_engine_client for -app_version and -omaha_url. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: Don't use ?: shorthand. Created 10 years, 5 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 e68a7aa6135c9d28561a2b0a6defc3aef1d161fd..bb4beaa328b03fdd97f53bb1cf0ecfb0a15731ad 100644
--- a/update_engine_client.cc
+++ b/update_engine_client.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <string>
+
#include <gflags/gflags.h>
#include <glib.h>
@@ -18,12 +20,17 @@ using chromeos_update_engine::kUpdateEngineServiceName;
using chromeos_update_engine::kUpdateEngineServicePath;
using chromeos_update_engine::kUpdateEngineServiceInterface;
using chromeos_update_engine::utils::GetGErrorMessage;
+using std::string;
-DEFINE_bool(status, false, "Print the status to stdout.");
-DEFINE_bool(force_update, false,
- "Force an update, even over an expensive network.");
+DEFINE_string(app_version, "",
+ "Force the current app version.");
DEFINE_bool(check_for_update, false,
"Initiate check for updates.");
+DEFINE_bool(force_update, false,
+ "Force an update, even over an expensive network.");
+DEFINE_string(omaha_url, "",
+ "The URL of the Omaha update server.");
+DEFINE_bool(status, false, "Print the status to stdout.");
DEFINE_bool(watch_for_updates, false,
"Listen for status updates and print them to the screen.");
@@ -134,14 +141,18 @@ void WatchForUpdates() {
g_main_loop_unref(loop);
}
-bool CheckForUpdates(bool force) {
+bool CheckForUpdates(bool force, const string& app_version,
+ const string& omaha_url) {
DBusGProxy* proxy;
GError* error = NULL;
CHECK(GetProxy(&proxy));
gboolean rc =
- org_chromium_UpdateEngineInterface_check_for_update(proxy, &error);
+ org_chromium_UpdateEngineInterface_attempt_update(proxy,
+ app_version.c_str(),
+ omaha_url.c_str(),
+ &error);
CHECK_EQ(rc, TRUE) << "Error checking for update: "
<< GetGErrorMessage(error);
return true;
@@ -164,12 +175,14 @@ int main(int argc, char** argv) {
}
return 0;
}
- if (FLAGS_force_update || FLAGS_check_for_update) {
+ if (FLAGS_force_update || FLAGS_check_for_update ||
+ !FLAGS_app_version.empty() || !FLAGS_omaha_url.empty()) {
LOG(INFO) << "Initiating update check and install.";
if (FLAGS_force_update) {
LOG(INFO) << "Will not abort due to being on expensive network.";
}
- CHECK(CheckForUpdates(FLAGS_force_update))
+ CHECK(CheckForUpdates(FLAGS_force_update, FLAGS_app_version,
+ FLAGS_omaha_url))
<< "Update check/initiate update failed.";
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