| 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 #include <tr1/memory> | 6 #include <tr1/memory> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include <gflags/gflags.h> | 9 #include <gflags/gflags.h> |
| 10 #include <glib.h> | 10 #include <glib.h> |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 } | 42 } |
| 43 | 43 |
| 44 gboolean UpdatePeriodically(void* arg) { | 44 gboolean UpdatePeriodically(void* arg) { |
| 45 UpdateAttempter* update_attempter = reinterpret_cast<UpdateAttempter*>(arg); | 45 UpdateAttempter* update_attempter = reinterpret_cast<UpdateAttempter*>(arg); |
| 46 update_attempter->Update("", ""); | 46 update_attempter->Update("", ""); |
| 47 return TRUE; | 47 return TRUE; |
| 48 } | 48 } |
| 49 | 49 |
| 50 void SchedulePeriodicUpdateChecks(UpdateAttempter* update_attempter) { | 50 void SchedulePeriodicUpdateChecks(UpdateAttempter* update_attempter) { |
| 51 if (!utils::IsOfficialBuild()) { | 51 if (!utils::IsOfficialBuild()) { |
| 52 LOG(WARNING) << "No periodic update checks on non-official builds."; | 52 LOG(WARNING) << "Non-official build: periodic update checks disabled."; |
| 53 return; | 53 return; |
| 54 } | 54 } |
| 55 | 55 |
| 56 if (utils::IsRemovableDevice(utils::RootDevice(utils::BootDevice()))) { |
| 57 LOG(WARNING) << "Removable device boot: periodic update checks disabled."; |
| 58 return; |
| 59 } |
| 60 |
| 56 // Kick off periodic updating. First, update after 2 minutes. Also, update | 61 // Kick off periodic updating. First, update after 2 minutes. Also, update |
| 57 // every 30 minutes. | 62 // every 30 minutes. |
| 58 g_timeout_add(2 * 60 * 1000, &UpdateOnce, update_attempter); | 63 g_timeout_add(2 * 60 * 1000, &UpdateOnce, update_attempter); |
| 59 g_timeout_add(30 * 60 * 1000, &UpdatePeriodically, update_attempter); | 64 g_timeout_add(30 * 60 * 1000, &UpdatePeriodically, update_attempter); |
| 60 } | 65 } |
| 61 | 66 |
| 62 void SetupDbusService(UpdateEngineService* service) { | 67 void SetupDbusService(UpdateEngineService* service) { |
| 63 DBusGConnection *bus; | 68 DBusGConnection *bus; |
| 64 DBusGProxy *proxy; | 69 DBusGProxy *proxy; |
| 65 GError *error = NULL; | 70 GError *error = NULL; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 g_main_loop_run(loop); | 151 g_main_loop_run(loop); |
| 147 | 152 |
| 148 // Cleanup: | 153 // Cleanup: |
| 149 g_main_loop_unref(loop); | 154 g_main_loop_unref(loop); |
| 150 update_attempter.set_dbus_service(NULL); | 155 update_attempter.set_dbus_service(NULL); |
| 151 g_object_unref(G_OBJECT(service)); | 156 g_object_unref(G_OBJECT(service)); |
| 152 | 157 |
| 153 LOG(INFO) << "Chrome OS Update Engine terminating"; | 158 LOG(INFO) << "Chrome OS Update Engine terminating"; |
| 154 return 0; | 159 return 0; |
| 155 } | 160 } |
| OLD | NEW |