| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include <gflags/gflags.h> | 7 #include <gflags/gflags.h> |
| 8 #include <glib.h> | 8 #include <glib.h> |
| 9 | 9 |
| 10 #include "update_engine/marshal.glibmarshal.h" | 10 #include "update_engine/marshal.glibmarshal.h" |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 if (FLAGS_update && app_version.empty()) { | 227 if (FLAGS_update && app_version.empty()) { |
| 228 app_version = "ForcedUpdate"; | 228 app_version = "ForcedUpdate"; |
| 229 LOG(INFO) << "Forcing an update by setting app_version to ForcedUpdate."; | 229 LOG(INFO) << "Forcing an update by setting app_version to ForcedUpdate."; |
| 230 } | 230 } |
| 231 LOG(INFO) << "Initiating update check and install."; | 231 LOG(INFO) << "Initiating update check and install."; |
| 232 CHECK(CheckForUpdates(app_version, FLAGS_omaha_url)) | 232 CHECK(CheckForUpdates(app_version, FLAGS_omaha_url)) |
| 233 << "Update check/initiate update failed."; | 233 << "Update check/initiate update failed."; |
| 234 | 234 |
| 235 // Wait for an update to complete. | 235 // Wait for an update to complete. |
| 236 if (FLAGS_update) { | 236 if (FLAGS_update) { |
| 237 LOG(INFO) << "Waiting for update the complete."; | 237 LOG(INFO) << "Waiting for update to complete."; |
| 238 CompleteUpdate(); // Should never return. | 238 CompleteUpdate(); // Should never return. |
| 239 return 1; | 239 return 1; |
| 240 } | 240 } |
| 241 return 0; | 241 return 0; |
| 242 } | 242 } |
| 243 | 243 |
| 244 // Start watching for updates. | 244 // Start watching for updates. |
| 245 if (FLAGS_watch_for_updates) { | 245 if (FLAGS_watch_for_updates) { |
| 246 LOG_IF(WARNING, FLAGS_reboot) << "-reboot flag ignored."; | 246 LOG_IF(WARNING, FLAGS_reboot) << "-reboot flag ignored."; |
| 247 LOG(INFO) << "Watching for status updates."; | 247 LOG(INFO) << "Watching for status updates."; |
| 248 WatchForUpdates(); // Should never return. | 248 WatchForUpdates(); // Should never return. |
| 249 return 1; | 249 return 1; |
| 250 } | 250 } |
| 251 | 251 |
| 252 if (FLAGS_reboot) { | 252 if (FLAGS_reboot) { |
| 253 LOG(INFO) << "Requesting a reboot..."; | 253 LOG(INFO) << "Requesting a reboot..."; |
| 254 CHECK(RebootIfNeeded()); | 254 CHECK(RebootIfNeeded()); |
| 255 return 0; | 255 return 0; |
| 256 } | 256 } |
| 257 | 257 |
| 258 LOG(INFO) << "No flags specified. Exiting."; | 258 LOG(INFO) << "No flags specified. Exiting."; |
| 259 return 0; | 259 return 0; |
| 260 } | 260 } |
| OLD | NEW |