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

Side by Side Diff: main.cc

Issue 2868105: Disable automatic update checks if booting from a removable device. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: Created 10 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698