Jay Srinivasan | c1ba09a | 2012-08-14 14:15:57 -0700 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
Andrew de los Reyes | 4e9b9f4 | 2010-04-26 15:06:43 -0700 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 5 | #include <inttypes.h> |
| 6 | #include <sysexits.h> |
| 7 | #include <unistd.h> |
| 8 | |
Darin Petkov | 5a7f565 | 2010-07-22 21:40:09 -0700 | [diff] [blame] | 9 | #include <string> |
| 10 | |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 11 | #include <base/bind.h> |
Alex Deymo | 8ce80d6 | 2015-01-27 15:10:43 -0800 | [diff] [blame] | 12 | #include <base/command_line.h> |
Alex Deymo | 44666f9 | 2014-07-22 20:29:24 -0700 | [diff] [blame] | 13 | #include <base/logging.h> |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 14 | #include <base/macros.h> |
| 15 | #include <chromeos/daemons/dbus_daemon.h> |
David Zeuthen | 9d73a72 | 2014-04-04 14:52:46 -0700 | [diff] [blame] | 16 | #include <chromeos/dbus/service_constants.h> |
Steve Fung | 97b6f5a | 2014-10-07 12:39:51 -0700 | [diff] [blame] | 17 | #include <chromeos/flag_helper.h> |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 18 | #include <dbus/bus.h> |
Andrew de los Reyes | 4e9b9f4 | 2010-04-26 15:06:43 -0700 | [diff] [blame] | 19 | |
| 20 | #include "update_engine/dbus_constants.h" |
Alex Deymo | d2956cc | 2015-08-17 15:39:40 -0700 | [diff] [blame^] | 21 | #include "update_engine/dbus-proxies.h" |
Andrew de los Reyes | 4e9b9f4 | 2010-04-26 15:06:43 -0700 | [diff] [blame] | 22 | |
David Zeuthen | 75a4c3e | 2013-09-06 11:36:59 -0700 | [diff] [blame] | 23 | using chromeos_update_engine::kAttemptUpdateFlagNonInteractive; |
Alex Deymo | 44666f9 | 2014-07-22 20:29:24 -0700 | [diff] [blame] | 24 | using chromeos_update_engine::kUpdateEngineServiceName; |
Darin Petkov | 5a7f565 | 2010-07-22 21:40:09 -0700 | [diff] [blame] | 25 | using std::string; |
Andrew de los Reyes | 4e9b9f4 | 2010-04-26 15:06:43 -0700 | [diff] [blame] | 26 | |
Andrew de los Reyes | 4e9b9f4 | 2010-04-26 15:06:43 -0700 | [diff] [blame] | 27 | namespace { |
| 28 | |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 29 | // Constant to signal that we need to continue running the daemon after |
| 30 | // initialization. |
| 31 | const int kContinueRunning = -1; |
Andrew de los Reyes | 4e9b9f4 | 2010-04-26 15:06:43 -0700 | [diff] [blame] | 32 | |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 33 | class UpdateEngineClient : public chromeos::DBusDaemon { |
| 34 | public: |
| 35 | UpdateEngineClient(int argc, char** argv) : argc_(argc), argv_(argv) {} |
| 36 | ~UpdateEngineClient() override = default; |
| 37 | |
| 38 | protected: |
| 39 | int OnInit() override { |
| 40 | int ret = DBusDaemon::OnInit(); |
| 41 | if (ret != EX_OK) |
| 42 | return ret; |
| 43 | if (!InitProxy()) |
| 44 | return 1; |
Alex Deymo | 13e0dd6 | 2015-06-30 23:11:44 -0700 | [diff] [blame] | 45 | // Wait for the UpdateEngine to be available or timeout. |
| 46 | proxy_->GetObjectProxy()->WaitForServiceToBeAvailable( |
| 47 | base::Bind(&UpdateEngineClient::OnServiceAvailable, |
| 48 | base::Unretained(this))); |
| 49 | base::MessageLoop::current()->PostDelayedTask( |
| 50 | FROM_HERE, |
| 51 | base::Bind(&UpdateEngineClient::OnServiceAvailableTimeout, |
| 52 | base::Unretained(this)), |
| 53 | base::TimeDelta::FromSeconds(10)); |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 54 | return EX_OK; |
Andrew de los Reyes | 68ab6ed | 2011-08-09 14:46:39 -0700 | [diff] [blame] | 55 | } |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 56 | |
| 57 | private: |
| 58 | bool InitProxy(); |
| 59 | |
Alex Deymo | 13e0dd6 | 2015-06-30 23:11:44 -0700 | [diff] [blame] | 60 | // Callback called when the UpdateEngine service becomes available. |
| 61 | void OnServiceAvailable(bool service_is_available); |
| 62 | |
| 63 | // Callback called when the UpdateEngine service doesn't become available |
| 64 | // after a timeout. |
| 65 | void OnServiceAvailableTimeout(); |
| 66 | |
| 67 | |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 68 | // Callback called when a StatusUpdate signal is received. |
| 69 | void OnStatusUpdateSignal(int64_t last_checked_time, |
| 70 | double progress, |
| 71 | const string& current_operation, |
| 72 | const string& new_version, |
| 73 | int64_t new_size); |
| 74 | // Callback called when the OnStatusUpdateSignal() handler is registered. |
| 75 | void OnStatusUpdateSignalRegistration(const string& interface, |
| 76 | const string& signal_name, |
| 77 | bool success); |
| 78 | |
| 79 | // Registers a callback that prints on stderr the received StatusUpdate |
| 80 | // signals. |
| 81 | // The daemon should continue running for this to work. |
| 82 | void WatchForUpdates(); |
| 83 | |
| 84 | void ResetStatus(); |
| 85 | |
| 86 | // Show the status of the update engine in stdout. |
| 87 | // Blocking call. Exits the program with error 1 in case of an error. |
| 88 | void ShowStatus(); |
| 89 | |
| 90 | // Return the current operation status, such as UPDATE_STATUS_IDLE. |
| 91 | // Blocking call. Exits the program with error 1 in case of an error. |
| 92 | string GetCurrentOperation(); |
| 93 | |
| 94 | void Rollback(bool rollback); |
| 95 | string GetRollbackPartition(); |
| 96 | string GetKernelDevices(); |
| 97 | void CheckForUpdates(const string& app_version, |
| 98 | const string& omaha_url, |
| 99 | bool interactive); |
| 100 | |
| 101 | // Reboot the device if a reboot is needed. |
| 102 | // Blocking call. Ignores failures. |
| 103 | void RebootIfNeeded(); |
| 104 | |
| 105 | // Getter and setter for the target channel. If |get_current_channel| is true, |
| 106 | // the current channel instead of the target channel will be returned. |
| 107 | // Blocking call. Exits the program with error 1 in case of an error. |
| 108 | void SetTargetChannel(const string& target_channel, bool allow_powerwash); |
| 109 | string GetChannel(bool get_current_channel); |
| 110 | |
| 111 | // Getter and setter for the updates over cellular connections. |
| 112 | // Blocking call. Exits the program with error 1 in case of an error. |
| 113 | void SetUpdateOverCellularPermission(bool allowed); |
| 114 | bool GetUpdateOverCellularPermission(); |
| 115 | |
| 116 | // Getter and setter for the updates from P2P permission. |
| 117 | // Blocking call. Exits the program with error 1 in case of an error. |
| 118 | void SetP2PUpdatePermission(bool enabled); |
| 119 | bool GetP2PUpdatePermission(); |
| 120 | |
| 121 | // This is similar to watching for updates but rather than registering |
| 122 | // a signal watch, actively poll the daemon just in case it stops |
| 123 | // sending notifications. |
| 124 | void WaitForUpdateComplete(); |
| 125 | void OnUpdateCompleteCheck(int64_t last_checked_time, |
| 126 | double progress, |
| 127 | const string& current_operation, |
| 128 | const string& new_version, |
| 129 | int64_t new_size); |
| 130 | |
| 131 | // Blocking call. Exits the program with error 1 in case of an error. |
| 132 | void ShowPrevVersion(); |
| 133 | |
| 134 | // Returns whether the current status is such that a reboot is needed. |
| 135 | // Blocking call. Exits the program with error 1 in case of an error. |
| 136 | bool GetIsRebootNeeded(); |
| 137 | |
| 138 | // Blocks until a reboot is needed. If the reboot is needed, exits the program |
| 139 | // with 0. Otherwise it exits the program with 1 if an error occurs before |
| 140 | // the reboot is needed. |
| 141 | void WaitForRebootNeeded(); |
| 142 | void OnRebootNeededCheck(int64_t last_checked_time, |
| 143 | double progress, |
| 144 | const string& current_operation, |
| 145 | const string& new_version, |
| 146 | int64_t new_size); |
| 147 | // Callback called when the OnRebootNeededCheck() handler is registered. This |
| 148 | // is useful to check at this point if the reboot is needed, without loosing |
| 149 | // any StatusUpdate signals and avoiding the race condition. |
| 150 | void OnRebootNeededCheckRegistration(const string& interface, |
| 151 | const string& signal_name, |
| 152 | bool success); |
| 153 | |
| 154 | // Main method that parses and triggers all the actions based on the passed |
| 155 | // flags. |
| 156 | int ProcessFlags(); |
| 157 | |
| 158 | // DBus Proxy to the update_engine daemon object used for all the calls. |
| 159 | std::unique_ptr<org::chromium::UpdateEngineInterfaceProxy> proxy_; |
| 160 | |
| 161 | // Copy of argc and argv passed to main(). |
| 162 | int argc_; |
| 163 | char** argv_; |
| 164 | |
Alex Deymo | 13e0dd6 | 2015-06-30 23:11:44 -0700 | [diff] [blame] | 165 | // Tell whether the UpdateEngine service is available after startup. |
| 166 | bool service_is_available_{false}; |
| 167 | |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 168 | DISALLOW_COPY_AND_ASSIGN(UpdateEngineClient); |
| 169 | }; |
| 170 | |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 171 | bool UpdateEngineClient::InitProxy() { |
| 172 | proxy_.reset(new org::chromium::UpdateEngineInterfaceProxy(bus_)); |
| 173 | |
| 174 | if (!proxy_->GetObjectProxy()) { |
| 175 | LOG(ERROR) << "Error getting dbus proxy for " << kUpdateEngineServiceName; |
| 176 | return false; |
Richard Barnette | d793606 | 2013-01-18 13:38:51 -0800 | [diff] [blame] | 177 | } |
Andrew de los Reyes | 63b96d7 | 2010-05-10 13:08:54 -0700 | [diff] [blame] | 178 | return true; |
| 179 | } |
| 180 | |
Alex Deymo | 13e0dd6 | 2015-06-30 23:11:44 -0700 | [diff] [blame] | 181 | void UpdateEngineClient::OnServiceAvailable(bool service_is_available) { |
| 182 | service_is_available_ = service_is_available; |
| 183 | if (!service_is_available) { |
| 184 | LOG(ERROR) << "UpdateEngineService not available."; |
| 185 | QuitWithExitCode(-1); |
| 186 | } |
| 187 | int ret = ProcessFlags(); |
| 188 | if (ret != kContinueRunning) |
| 189 | QuitWithExitCode(ret); |
| 190 | } |
| 191 | |
| 192 | void UpdateEngineClient::OnServiceAvailableTimeout() { |
| 193 | if (!service_is_available_) { |
| 194 | LOG(ERROR) << "Waiting for UpdateEngineService timeout. Is update_engine " |
| 195 | "daemon running?"; |
| 196 | QuitWithExitCode(-1); |
| 197 | } |
| 198 | } |
| 199 | |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 200 | void UpdateEngineClient::OnStatusUpdateSignal( |
| 201 | int64_t last_checked_time, |
| 202 | double progress, |
| 203 | const string& current_operation, |
| 204 | const string& new_version, |
| 205 | int64_t new_size) { |
Andrew de los Reyes | 63b96d7 | 2010-05-10 13:08:54 -0700 | [diff] [blame] | 206 | LOG(INFO) << "Got status update:"; |
| 207 | LOG(INFO) << " last_checked_time: " << last_checked_time; |
| 208 | LOG(INFO) << " progress: " << progress; |
| 209 | LOG(INFO) << " current_operation: " << current_operation; |
| 210 | LOG(INFO) << " new_version: " << new_version; |
| 211 | LOG(INFO) << " new_size: " << new_size; |
| 212 | } |
| 213 | |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 214 | void UpdateEngineClient::OnStatusUpdateSignalRegistration( |
| 215 | const string& interface, |
| 216 | const string& signal_name, |
| 217 | bool success) { |
| 218 | VLOG(1) << "OnStatusUpdateSignalRegistration(" << interface << ", " |
| 219 | << signal_name << ", " << success << ");"; |
| 220 | if (!success) { |
| 221 | LOG(ERROR) << "Couldn't connect to the " << signal_name << " signal."; |
| 222 | exit(1); |
| 223 | } |
Jay Srinivasan | c1ba09a | 2012-08-14 14:15:57 -0700 | [diff] [blame] | 224 | } |
| 225 | |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 226 | void UpdateEngineClient::WatchForUpdates() { |
| 227 | proxy_->RegisterStatusUpdateSignalHandler( |
| 228 | base::Bind(&UpdateEngineClient::OnStatusUpdateSignal, |
| 229 | base::Unretained(this)), |
| 230 | base::Bind(&UpdateEngineClient::OnStatusUpdateSignalRegistration, |
| 231 | base::Unretained(this))); |
| 232 | } |
Jay Srinivasan | c1ba09a | 2012-08-14 14:15:57 -0700 | [diff] [blame] | 233 | |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 234 | void UpdateEngineClient::ResetStatus() { |
| 235 | bool ret = proxy_->ResetStatus(nullptr); |
| 236 | CHECK(ret) << "ResetStatus() failed."; |
| 237 | } |
Andrew de los Reyes | ada4220 | 2010-07-15 22:23:20 -0700 | [diff] [blame] | 238 | |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 239 | void UpdateEngineClient::ShowStatus() { |
| 240 | int64_t last_checked_time = 0; |
| 241 | double progress = 0.0; |
| 242 | string current_op; |
| 243 | string new_version; |
| 244 | int64_t new_size = 0; |
Andrew de los Reyes | 4e9b9f4 | 2010-04-26 15:06:43 -0700 | [diff] [blame] | 245 | |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 246 | bool ret = proxy_->GetStatus( |
| 247 | &last_checked_time, &progress, ¤t_op, &new_version, &new_size, |
| 248 | nullptr); |
| 249 | CHECK(ret) << "GetStatus() failed"; |
Andrew de los Reyes | 4e9b9f4 | 2010-04-26 15:06:43 -0700 | [diff] [blame] | 250 | printf("LAST_CHECKED_TIME=%" PRIi64 "\nPROGRESS=%f\nCURRENT_OP=%s\n" |
| 251 | "NEW_VERSION=%s\nNEW_SIZE=%" PRIi64 "\n", |
| 252 | last_checked_time, |
| 253 | progress, |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 254 | current_op.c_str(), |
| 255 | new_version.c_str(), |
Andrew de los Reyes | 4e9b9f4 | 2010-04-26 15:06:43 -0700 | [diff] [blame] | 256 | new_size); |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 257 | } |
| 258 | |
| 259 | string UpdateEngineClient::GetCurrentOperation() { |
| 260 | int64_t last_checked_time = 0; |
| 261 | double progress = 0.0; |
| 262 | string current_op; |
| 263 | string new_version; |
| 264 | int64_t new_size = 0; |
| 265 | |
| 266 | bool ret = proxy_->GetStatus( |
| 267 | &last_checked_time, &progress, ¤t_op, &new_version, &new_size, |
| 268 | nullptr); |
| 269 | CHECK(ret) << "GetStatus() failed"; |
| 270 | return current_op; |
| 271 | } |
| 272 | |
| 273 | void UpdateEngineClient::Rollback(bool rollback) { |
| 274 | bool ret = proxy_->AttemptRollback(rollback, nullptr); |
| 275 | CHECK(ret) << "Rollback request failed."; |
| 276 | } |
| 277 | |
| 278 | string UpdateEngineClient::GetRollbackPartition() { |
| 279 | string rollback_partition; |
| 280 | bool ret = proxy_->GetRollbackPartition(&rollback_partition, nullptr); |
| 281 | CHECK(ret) << "Error while querying rollback partition availabilty."; |
| 282 | return rollback_partition; |
| 283 | } |
| 284 | |
| 285 | string UpdateEngineClient::GetKernelDevices() { |
| 286 | string kernel_devices; |
| 287 | bool ret = proxy_->GetKernelDevices(&kernel_devices, nullptr); |
| 288 | CHECK(ret) << "Error while getting a list of kernel devices"; |
| 289 | return kernel_devices; |
| 290 | } |
| 291 | |
| 292 | void UpdateEngineClient::CheckForUpdates(const string& app_version, |
| 293 | const string& omaha_url, |
| 294 | bool interactive) { |
| 295 | int32_t flags = interactive ? 0 : kAttemptUpdateFlagNonInteractive; |
| 296 | bool ret = proxy_->AttemptUpdateWithFlags(app_version, omaha_url, flags, |
| 297 | nullptr); |
| 298 | CHECK(ret) << "Error checking for update."; |
| 299 | } |
| 300 | |
| 301 | void UpdateEngineClient::RebootIfNeeded() { |
| 302 | bool ret = proxy_->RebootIfNeeded(nullptr); |
| 303 | if (!ret) { |
| 304 | // Reboot error code doesn't necessarily mean that a reboot |
| 305 | // failed. For example, D-Bus may be shutdown before we receive the |
| 306 | // result. |
| 307 | LOG(INFO) << "RebootIfNeeded() failure ignored."; |
Darin Petkov | 58529db | 2010-08-13 09:19:47 -0700 | [diff] [blame] | 308 | } |
Andrew de los Reyes | 4e9b9f4 | 2010-04-26 15:06:43 -0700 | [diff] [blame] | 309 | } |
| 310 | |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 311 | void UpdateEngineClient::SetTargetChannel(const string& target_channel, |
| 312 | bool allow_powerwash) { |
| 313 | bool ret = proxy_->SetChannel(target_channel, allow_powerwash, nullptr); |
| 314 | CHECK(ret) << "Error setting the channel."; |
Jay Srinivasan | ae4697c | 2013-03-18 17:08:08 -0700 | [diff] [blame] | 315 | LOG(INFO) << "Channel permanently set to: " << target_channel; |
Darin Petkov | 8daa324 | 2010-10-25 13:28:47 -0700 | [diff] [blame] | 316 | } |
| 317 | |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 318 | string UpdateEngineClient::GetChannel(bool get_current_channel) { |
| 319 | string channel; |
| 320 | bool ret = proxy_->GetChannel(get_current_channel, &channel, nullptr); |
| 321 | CHECK(ret) << "Error getting the channel."; |
| 322 | return channel; |
Satoru Takabayashi | 583667b | 2010-10-27 13:09:57 +0900 | [diff] [blame] | 323 | } |
| 324 | |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 325 | void UpdateEngineClient::SetUpdateOverCellularPermission(bool allowed) { |
| 326 | bool ret = proxy_->SetUpdateOverCellularPermission(allowed, nullptr); |
| 327 | CHECK(ret) << "Error setting the update over cellular setting."; |
Alex Deymo | f4867c4 | 2013-06-28 14:41:39 -0700 | [diff] [blame] | 328 | } |
| 329 | |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 330 | bool UpdateEngineClient::GetUpdateOverCellularPermission() { |
| 331 | bool allowed; |
| 332 | bool ret = proxy_->GetUpdateOverCellularPermission(&allowed, nullptr); |
| 333 | CHECK(ret) << "Error getting the update over cellular setting."; |
Alex Deymo | f4867c4 | 2013-06-28 14:41:39 -0700 | [diff] [blame] | 334 | return allowed; |
| 335 | } |
| 336 | |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 337 | void UpdateEngineClient::SetP2PUpdatePermission(bool enabled) { |
| 338 | bool ret = proxy_->SetP2PUpdatePermission(enabled, nullptr); |
| 339 | CHECK(ret) << "Error setting the peer-to-peer update setting."; |
Alex Deymo | 5fdf776 | 2013-07-17 20:01:40 -0700 | [diff] [blame] | 340 | } |
| 341 | |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 342 | bool UpdateEngineClient::GetP2PUpdatePermission() { |
| 343 | bool enabled; |
| 344 | bool ret = proxy_->GetP2PUpdatePermission(&enabled, nullptr); |
| 345 | CHECK(ret) << "Error getting the peer-to-peer update setting."; |
Alex Deymo | 5fdf776 | 2013-07-17 20:01:40 -0700 | [diff] [blame] | 346 | return enabled; |
| 347 | } |
| 348 | |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 349 | void UpdateEngineClient::OnUpdateCompleteCheck( |
| 350 | int64_t /* last_checked_time */, |
| 351 | double /* progress */, |
| 352 | const string& current_operation, |
| 353 | const string& /* new_version */, |
| 354 | int64_t /* new_size */) { |
| 355 | if (current_operation == update_engine::kUpdateStatusIdle) { |
| 356 | LOG(ERROR) << "Update failed, current operations is " << current_operation; |
Darin Petkov | 58529db | 2010-08-13 09:19:47 -0700 | [diff] [blame] | 357 | exit(1); |
| 358 | } |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 359 | if (current_operation == update_engine::kUpdateStatusUpdatedNeedReboot) { |
Darin Petkov | 58529db | 2010-08-13 09:19:47 -0700 | [diff] [blame] | 360 | LOG(INFO) << "Update succeeded -- reboot needed."; |
| 361 | exit(0); |
| 362 | } |
Darin Petkov | 58529db | 2010-08-13 09:19:47 -0700 | [diff] [blame] | 363 | } |
| 364 | |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 365 | void UpdateEngineClient::WaitForUpdateComplete() { |
| 366 | proxy_->RegisterStatusUpdateSignalHandler( |
| 367 | base::Bind(&UpdateEngineClient::OnUpdateCompleteCheck, |
| 368 | base::Unretained(this)), |
| 369 | base::Bind(&UpdateEngineClient::OnStatusUpdateSignalRegistration, |
| 370 | base::Unretained(this))); |
Darin Petkov | 58529db | 2010-08-13 09:19:47 -0700 | [diff] [blame] | 371 | } |
| 372 | |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 373 | void UpdateEngineClient::ShowPrevVersion() { |
| 374 | string prev_version = nullptr; |
Alex Vakulenko | dea2eac | 2014-03-14 15:56:59 -0700 | [diff] [blame] | 375 | |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 376 | bool ret = proxy_->GetPrevVersion(&prev_version, nullptr);; |
| 377 | if (!ret) { |
| 378 | LOG(ERROR) << "Error getting previous version."; |
Alex Vakulenko | dea2eac | 2014-03-14 15:56:59 -0700 | [diff] [blame] | 379 | } else { |
| 380 | LOG(INFO) << "Previous version = " << prev_version; |
Alex Vakulenko | dea2eac | 2014-03-14 15:56:59 -0700 | [diff] [blame] | 381 | } |
| 382 | } |
| 383 | |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 384 | bool UpdateEngineClient::GetIsRebootNeeded() { |
| 385 | return GetCurrentOperation() == update_engine::kUpdateStatusUpdatedNeedReboot; |
David Zeuthen | 9d73a72 | 2014-04-04 14:52:46 -0700 | [diff] [blame] | 386 | } |
| 387 | |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 388 | void UpdateEngineClient::OnRebootNeededCheck( |
| 389 | int64_t /* last_checked_time */, |
| 390 | double /* progress */, |
| 391 | const string& current_operation, |
| 392 | const string& /* new_version */, |
| 393 | int64_t /* new_size */) { |
| 394 | if (current_operation == update_engine::kUpdateStatusUpdatedNeedReboot) { |
| 395 | LOG(INFO) << "Reboot needed."; |
| 396 | exit(0); |
David Zeuthen | 9d73a72 | 2014-04-04 14:52:46 -0700 | [diff] [blame] | 397 | } |
| 398 | } |
| 399 | |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 400 | void UpdateEngineClient::OnRebootNeededCheckRegistration( |
| 401 | const string& interface, |
| 402 | const string& signal_name, |
| 403 | bool success) { |
| 404 | if (GetIsRebootNeeded()) |
| 405 | exit(0); |
| 406 | if (!success) { |
| 407 | LOG(ERROR) << "Couldn't connect to the " << signal_name << " signal."; |
| 408 | exit(1); |
| 409 | } |
David Zeuthen | 9d73a72 | 2014-04-04 14:52:46 -0700 | [diff] [blame] | 410 | } |
| 411 | |
| 412 | // Blocks until a reboot is needed. Returns true if waiting succeeded, |
| 413 | // false if an error occurred. |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 414 | void UpdateEngineClient::WaitForRebootNeeded() { |
| 415 | proxy_->RegisterStatusUpdateSignalHandler( |
| 416 | base::Bind(&UpdateEngineClient::OnUpdateCompleteCheck, |
| 417 | base::Unretained(this)), |
| 418 | base::Bind(&UpdateEngineClient::OnStatusUpdateSignalRegistration, |
| 419 | base::Unretained(this))); |
| 420 | if (GetIsRebootNeeded()) |
| 421 | exit(0); |
David Zeuthen | 9d73a72 | 2014-04-04 14:52:46 -0700 | [diff] [blame] | 422 | } |
| 423 | |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 424 | int UpdateEngineClient::ProcessFlags() { |
Steve Fung | 97b6f5a | 2014-10-07 12:39:51 -0700 | [diff] [blame] | 425 | DEFINE_string(app_version, "", "Force the current app version."); |
| 426 | DEFINE_string(channel, "", |
| 427 | "Set the target channel. The device will be powerwashed if the " |
| 428 | "target channel is more stable than the current channel unless " |
| 429 | "--nopowerwash is specified."); |
| 430 | DEFINE_bool(check_for_update, false, "Initiate check for updates."); |
| 431 | DEFINE_bool(follow, false, "Wait for any update operations to complete." |
| 432 | "Exit status is 0 if the update succeeded, and 1 otherwise."); |
| 433 | DEFINE_bool(interactive, true, "Mark the update request as interactive."); |
| 434 | DEFINE_string(omaha_url, "", "The URL of the Omaha update server."); |
| 435 | DEFINE_string(p2p_update, "", |
| 436 | "Enables (\"yes\") or disables (\"no\") the peer-to-peer update" |
| 437 | " sharing."); |
| 438 | DEFINE_bool(powerwash, true, "When performing rollback or channel change, " |
| 439 | "do a powerwash or allow it respectively."); |
| 440 | DEFINE_bool(reboot, false, "Initiate a reboot if needed."); |
| 441 | DEFINE_bool(is_reboot_needed, false, "Exit status 0 if reboot is needed, " |
| 442 | "2 if reboot is not needed or 1 if an error occurred."); |
| 443 | DEFINE_bool(block_until_reboot_is_needed, false, "Blocks until reboot is " |
| 444 | "needed. Returns non-zero exit status if an error occurred."); |
| 445 | DEFINE_bool(reset_status, false, "Sets the status in update_engine to idle."); |
Alex Deymo | 1ac8b59 | 2015-01-26 13:22:58 -0800 | [diff] [blame] | 446 | DEFINE_bool(rollback, false, |
| 447 | "Perform a rollback to the previous partition. The device will " |
| 448 | "be powerwashed unless --nopowerwash is specified."); |
Steve Fung | 97b6f5a | 2014-10-07 12:39:51 -0700 | [diff] [blame] | 449 | DEFINE_bool(can_rollback, false, "Shows whether rollback partition " |
| 450 | "is available."); |
| 451 | DEFINE_bool(show_channel, false, "Show the current and target channels."); |
| 452 | DEFINE_bool(show_p2p_update, false, |
| 453 | "Show the current setting for peer-to-peer update sharing."); |
| 454 | DEFINE_bool(show_update_over_cellular, false, |
| 455 | "Show the current setting for updates over cellular networks."); |
| 456 | DEFINE_bool(status, false, "Print the status to stdout."); |
| 457 | DEFINE_bool(update, false, "Forces an update and waits for it to complete. " |
| 458 | "Implies --follow."); |
| 459 | DEFINE_string(update_over_cellular, "", |
| 460 | "Enables (\"yes\") or disables (\"no\") the updates over " |
| 461 | "cellular networks."); |
| 462 | DEFINE_bool(watch_for_updates, false, |
| 463 | "Listen for status updates and print them to the screen."); |
| 464 | DEFINE_bool(prev_version, false, |
| 465 | "Show the previous OS version used before the update reboot."); |
| 466 | DEFINE_bool(show_kernels, false, "Show the list of kernel patritions and " |
| 467 | "whether each of them is bootable or not"); |
| 468 | |
Andrew de los Reyes | 4e9b9f4 | 2010-04-26 15:06:43 -0700 | [diff] [blame] | 469 | // Boilerplate init commands. |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 470 | base::CommandLine::Init(argc_, argv_); |
| 471 | chromeos::FlagHelper::Init(argc_, argv_, "Chromium OS Update Engine Client"); |
Andrew de los Reyes | ada4220 | 2010-07-15 22:23:20 -0700 | [diff] [blame] | 472 | |
Alex Deymo | 8ce80d6 | 2015-01-27 15:10:43 -0800 | [diff] [blame] | 473 | // Ensure there are no positional arguments. |
| 474 | const std::vector<string> positional_args = |
| 475 | base::CommandLine::ForCurrentProcess()->GetArgs(); |
| 476 | if (!positional_args.empty()) { |
| 477 | LOG(ERROR) << "Found a positional argument '" << positional_args.front() |
| 478 | << "'. If you want to pass a value to a flag, pass it as " |
| 479 | "--flag=value."; |
| 480 | return 1; |
| 481 | } |
| 482 | |
Jay Srinivasan | c1ba09a | 2012-08-14 14:15:57 -0700 | [diff] [blame] | 483 | // Update the status if requested. |
| 484 | if (FLAGS_reset_status) { |
| 485 | LOG(INFO) << "Setting Update Engine status to idle ..."; |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 486 | ResetStatus(); |
Gilad Arnold | 50c6063 | 2013-01-25 10:27:19 -0800 | [diff] [blame] | 487 | LOG(INFO) << "ResetStatus succeeded; to undo partition table changes run:\n" |
| 488 | "(D=$(rootdev -d) P=$(rootdev -s); cgpt p -i$(($(echo ${P#$D} " |
| 489 | "| sed 's/^[^0-9]*//')-1)) $D;)"; |
Andrew de los Reyes | 4e9b9f4 | 2010-04-26 15:06:43 -0700 | [diff] [blame] | 490 | } |
Darin Petkov | 58529db | 2010-08-13 09:19:47 -0700 | [diff] [blame] | 491 | |
Alex Deymo | f4867c4 | 2013-06-28 14:41:39 -0700 | [diff] [blame] | 492 | // Changes the current update over cellular network setting. |
| 493 | if (!FLAGS_update_over_cellular.empty()) { |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 494 | bool allowed = FLAGS_update_over_cellular == "yes"; |
Alex Deymo | f4867c4 | 2013-06-28 14:41:39 -0700 | [diff] [blame] | 495 | if (!allowed && FLAGS_update_over_cellular != "no") { |
| 496 | LOG(ERROR) << "Unknown option: \"" << FLAGS_update_over_cellular |
| 497 | << "\". Please specify \"yes\" or \"no\"."; |
| 498 | } else { |
| 499 | SetUpdateOverCellularPermission(allowed); |
| 500 | } |
| 501 | } |
| 502 | |
| 503 | // Show the current update over cellular network setting. |
| 504 | if (FLAGS_show_update_over_cellular) { |
| 505 | bool allowed = GetUpdateOverCellularPermission(); |
| 506 | LOG(INFO) << "Current update over cellular network setting: " |
| 507 | << (allowed ? "ENABLED" : "DISABLED"); |
| 508 | } |
| 509 | |
Chris Sosa | cb7fa88 | 2013-07-25 17:02:59 -0700 | [diff] [blame] | 510 | if (!FLAGS_powerwash && !FLAGS_rollback && FLAGS_channel.empty()) { |
Chris Sosa | 192449e | 2013-10-28 14:16:19 -0700 | [diff] [blame] | 511 | LOG(ERROR) << "powerwash flag only makes sense rollback or channel change"; |
Chris Sosa | cb7fa88 | 2013-07-25 17:02:59 -0700 | [diff] [blame] | 512 | return 1; |
| 513 | } |
| 514 | |
Alex Deymo | 5fdf776 | 2013-07-17 20:01:40 -0700 | [diff] [blame] | 515 | // Change the P2P enabled setting. |
| 516 | if (!FLAGS_p2p_update.empty()) { |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 517 | bool enabled = FLAGS_p2p_update == "yes"; |
Alex Deymo | 5fdf776 | 2013-07-17 20:01:40 -0700 | [diff] [blame] | 518 | if (!enabled && FLAGS_p2p_update != "no") { |
| 519 | LOG(ERROR) << "Unknown option: \"" << FLAGS_p2p_update |
| 520 | << "\". Please specify \"yes\" or \"no\"."; |
| 521 | } else { |
| 522 | SetP2PUpdatePermission(enabled); |
| 523 | } |
| 524 | } |
| 525 | |
Alex Vakulenko | 59e253e | 2014-02-24 10:40:21 -0800 | [diff] [blame] | 526 | // Show the rollback availability. |
| 527 | if (FLAGS_can_rollback) { |
Alex Deymo | f329b93 | 2014-10-30 01:37:48 -0700 | [diff] [blame] | 528 | string rollback_partition = GetRollbackPartition(); |
Chris Sosa | f5c0b9c | 2014-04-17 16:12:03 -0700 | [diff] [blame] | 529 | bool can_rollback = true; |
| 530 | if (rollback_partition.empty()) { |
Alex Vakulenko | 2bddadd | 2014-03-27 13:23:46 -0700 | [diff] [blame] | 531 | rollback_partition = "UNAVAILABLE"; |
Chris Sosa | f5c0b9c | 2014-04-17 16:12:03 -0700 | [diff] [blame] | 532 | can_rollback = false; |
Alex Vakulenko | d2779df | 2014-06-16 13:19:00 -0700 | [diff] [blame] | 533 | } else { |
Alex Vakulenko | 2bddadd | 2014-03-27 13:23:46 -0700 | [diff] [blame] | 534 | rollback_partition = "AVAILABLE: " + rollback_partition; |
Alex Vakulenko | d2779df | 2014-06-16 13:19:00 -0700 | [diff] [blame] | 535 | } |
Alex Vakulenko | 2bddadd | 2014-03-27 13:23:46 -0700 | [diff] [blame] | 536 | |
| 537 | LOG(INFO) << "Rollback partition: " << rollback_partition; |
Chris Sosa | f5c0b9c | 2014-04-17 16:12:03 -0700 | [diff] [blame] | 538 | if (!can_rollback) { |
| 539 | return 1; |
| 540 | } |
Alex Vakulenko | 59e253e | 2014-02-24 10:40:21 -0800 | [diff] [blame] | 541 | } |
| 542 | |
Alex Deymo | 5fdf776 | 2013-07-17 20:01:40 -0700 | [diff] [blame] | 543 | // Show the current P2P enabled setting. |
| 544 | if (FLAGS_show_p2p_update) { |
| 545 | bool enabled = GetP2PUpdatePermission(); |
| 546 | LOG(INFO) << "Current update using P2P setting: " |
| 547 | << (enabled ? "ENABLED" : "DISABLED"); |
| 548 | } |
| 549 | |
Jay Srinivasan | ae4697c | 2013-03-18 17:08:08 -0700 | [diff] [blame] | 550 | // First, update the target channel if requested. |
| 551 | if (!FLAGS_channel.empty()) |
Chris Sosa | cb7fa88 | 2013-07-25 17:02:59 -0700 | [diff] [blame] | 552 | SetTargetChannel(FLAGS_channel, FLAGS_powerwash); |
Darin Petkov | 8daa324 | 2010-10-25 13:28:47 -0700 | [diff] [blame] | 553 | |
Jay Srinivasan | ae4697c | 2013-03-18 17:08:08 -0700 | [diff] [blame] | 554 | // Show the current and target channels if requested. |
| 555 | if (FLAGS_show_channel) { |
| 556 | string current_channel = GetChannel(true); |
| 557 | LOG(INFO) << "Current Channel: " << current_channel; |
| 558 | |
| 559 | string target_channel = GetChannel(false); |
| 560 | if (!target_channel.empty()) |
| 561 | LOG(INFO) << "Target Channel (pending update): " << target_channel; |
Satoru Takabayashi | 583667b | 2010-10-27 13:09:57 +0900 | [diff] [blame] | 562 | } |
| 563 | |
Chris Sosa | d317e40 | 2013-06-12 13:47:09 -0700 | [diff] [blame] | 564 | bool do_update_request = FLAGS_check_for_update | FLAGS_update | |
| 565 | !FLAGS_app_version.empty() | !FLAGS_omaha_url.empty(); |
Chris Sosa | 192449e | 2013-10-28 14:16:19 -0700 | [diff] [blame] | 566 | if (FLAGS_update) |
| 567 | FLAGS_follow = true; |
Chris Sosa | d317e40 | 2013-06-12 13:47:09 -0700 | [diff] [blame] | 568 | |
Chris Sosa | d317e40 | 2013-06-12 13:47:09 -0700 | [diff] [blame] | 569 | if (do_update_request && FLAGS_rollback) { |
Chris Sosa | 192449e | 2013-10-28 14:16:19 -0700 | [diff] [blame] | 570 | LOG(ERROR) << "Incompatible flags specified with rollback." |
| 571 | << "Rollback should not include update-related flags."; |
Chris Sosa | d317e40 | 2013-06-12 13:47:09 -0700 | [diff] [blame] | 572 | return 1; |
| 573 | } |
| 574 | |
Alex Vakulenko | d2779df | 2014-06-16 13:19:00 -0700 | [diff] [blame] | 575 | if (FLAGS_rollback) { |
Chris Sosa | d317e40 | 2013-06-12 13:47:09 -0700 | [diff] [blame] | 576 | LOG(INFO) << "Requesting rollback."; |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 577 | Rollback(FLAGS_powerwash); |
Chris Sosa | d317e40 | 2013-06-12 13:47:09 -0700 | [diff] [blame] | 578 | } |
| 579 | |
Darin Petkov | 58529db | 2010-08-13 09:19:47 -0700 | [diff] [blame] | 580 | // Initiate an update check, if necessary. |
Chris Sosa | d317e40 | 2013-06-12 13:47:09 -0700 | [diff] [blame] | 581 | if (do_update_request) { |
Darin Petkov | 296889c | 2010-07-23 16:20:54 -0700 | [diff] [blame] | 582 | LOG_IF(WARNING, FLAGS_reboot) << "-reboot flag ignored."; |
Darin Petkov | 58529db | 2010-08-13 09:19:47 -0700 | [diff] [blame] | 583 | string app_version = FLAGS_app_version; |
| 584 | if (FLAGS_update && app_version.empty()) { |
| 585 | app_version = "ForcedUpdate"; |
| 586 | LOG(INFO) << "Forcing an update by setting app_version to ForcedUpdate."; |
Andrew de los Reyes | 4e9b9f4 | 2010-04-26 15:06:43 -0700 | [diff] [blame] | 587 | } |
Darin Petkov | 58529db | 2010-08-13 09:19:47 -0700 | [diff] [blame] | 588 | LOG(INFO) << "Initiating update check and install."; |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 589 | CheckForUpdates(app_version, FLAGS_omaha_url, FLAGS_interactive); |
Chris Sosa | 192449e | 2013-10-28 14:16:19 -0700 | [diff] [blame] | 590 | } |
Darin Petkov | 58529db | 2010-08-13 09:19:47 -0700 | [diff] [blame] | 591 | |
Chris Sosa | 192449e | 2013-10-28 14:16:19 -0700 | [diff] [blame] | 592 | // These final options are all mutually exclusive with one another. |
David Zeuthen | 9d73a72 | 2014-04-04 14:52:46 -0700 | [diff] [blame] | 593 | if (FLAGS_follow + FLAGS_watch_for_updates + FLAGS_reboot + |
| 594 | FLAGS_status + FLAGS_is_reboot_needed + |
Alex Vakulenko | d2779df | 2014-06-16 13:19:00 -0700 | [diff] [blame] | 595 | FLAGS_block_until_reboot_is_needed > 1) { |
Chris Sosa | 192449e | 2013-10-28 14:16:19 -0700 | [diff] [blame] | 596 | LOG(ERROR) << "Multiple exclusive options selected. " |
| 597 | << "Select only one of --follow, --watch_for_updates, --reboot, " |
David Zeuthen | 9d73a72 | 2014-04-04 14:52:46 -0700 | [diff] [blame] | 598 | << "--is_reboot_needed, --block_until_reboot_is_needed, " |
Chris Sosa | 192449e | 2013-10-28 14:16:19 -0700 | [diff] [blame] | 599 | << "or --status."; |
| 600 | return 1; |
| 601 | } |
| 602 | |
| 603 | if (FLAGS_status) { |
| 604 | LOG(INFO) << "Querying Update Engine status..."; |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 605 | ShowStatus(); |
Andrew de los Reyes | 4e9b9f4 | 2010-04-26 15:06:43 -0700 | [diff] [blame] | 606 | return 0; |
| 607 | } |
Darin Petkov | 58529db | 2010-08-13 09:19:47 -0700 | [diff] [blame] | 608 | |
Chris Sosa | 192449e | 2013-10-28 14:16:19 -0700 | [diff] [blame] | 609 | if (FLAGS_follow) { |
| 610 | LOG(INFO) << "Waiting for update to complete."; |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 611 | WaitForUpdateComplete(); |
| 612 | return kContinueRunning; |
Chris Sosa | 192449e | 2013-10-28 14:16:19 -0700 | [diff] [blame] | 613 | } |
| 614 | |
Andrew de los Reyes | 63b96d7 | 2010-05-10 13:08:54 -0700 | [diff] [blame] | 615 | if (FLAGS_watch_for_updates) { |
| 616 | LOG(INFO) << "Watching for status updates."; |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 617 | WatchForUpdates(); |
| 618 | return kContinueRunning; |
Andrew de los Reyes | 63b96d7 | 2010-05-10 13:08:54 -0700 | [diff] [blame] | 619 | } |
Darin Petkov | 58529db | 2010-08-13 09:19:47 -0700 | [diff] [blame] | 620 | |
Darin Petkov | 296889c | 2010-07-23 16:20:54 -0700 | [diff] [blame] | 621 | if (FLAGS_reboot) { |
| 622 | LOG(INFO) << "Requesting a reboot..."; |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 623 | RebootIfNeeded(); |
Darin Petkov | 296889c | 2010-07-23 16:20:54 -0700 | [diff] [blame] | 624 | return 0; |
| 625 | } |
Andrew de los Reyes | ada4220 | 2010-07-15 22:23:20 -0700 | [diff] [blame] | 626 | |
Alex Vakulenko | dea2eac | 2014-03-14 15:56:59 -0700 | [diff] [blame] | 627 | if (FLAGS_prev_version) { |
| 628 | ShowPrevVersion(); |
| 629 | } |
| 630 | |
Alex Vakulenko | 2bddadd | 2014-03-27 13:23:46 -0700 | [diff] [blame] | 631 | if (FLAGS_show_kernels) { |
| 632 | LOG(INFO) << "Kernel partitions:\n" |
| 633 | << GetKernelDevices(); |
| 634 | } |
| 635 | |
David Zeuthen | 9d73a72 | 2014-04-04 14:52:46 -0700 | [diff] [blame] | 636 | if (FLAGS_is_reboot_needed) { |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 637 | // In case of error GetIsRebootNeeded() will exit with 1. |
| 638 | if (GetIsRebootNeeded()) { |
| 639 | return 0; |
| 640 | } else { |
David Zeuthen | 9d73a72 | 2014-04-04 14:52:46 -0700 | [diff] [blame] | 641 | return 2; |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 642 | } |
David Zeuthen | 9d73a72 | 2014-04-04 14:52:46 -0700 | [diff] [blame] | 643 | } |
| 644 | |
| 645 | if (FLAGS_block_until_reboot_is_needed) { |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 646 | WaitForRebootNeeded(); |
| 647 | return kContinueRunning; |
David Zeuthen | 9d73a72 | 2014-04-04 14:52:46 -0700 | [diff] [blame] | 648 | } |
| 649 | |
Andrew de los Reyes | 4e9b9f4 | 2010-04-26 15:06:43 -0700 | [diff] [blame] | 650 | return 0; |
| 651 | } |
Alex Deymo | 72aa002 | 2015-06-19 21:16:49 -0700 | [diff] [blame] | 652 | |
| 653 | } // namespace |
| 654 | |
| 655 | int main(int argc, char** argv) { |
| 656 | UpdateEngineClient client(argc, argv); |
| 657 | return client.Run(); |
| 658 | } |