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 <base/at_exit.h> | 9 #include <base/at_exit.h> |
10 #include <base/command_line.h> | 10 #include <base/command_line.h> |
11 #include <base/logging.h> | 11 #include <base/logging.h> |
12 #include <base/string_util.h> | 12 #include <base/string_util.h> |
13 #include <gflags/gflags.h> | 13 #include <gflags/gflags.h> |
14 #include <glib.h> | 14 #include <glib.h> |
15 #include <metrics/metrics_library.h> | 15 #include <metrics/metrics_library.h> |
16 #include <sys/types.h> | 16 #include <sys/types.h> |
17 #include <sys/stat.h> | 17 #include <sys/stat.h> |
18 | 18 |
19 #include "update_engine/dbus_constants.h" | 19 #include "update_engine/dbus_constants.h" |
20 #include "update_engine/dbus_service.h" | 20 #include "update_engine/dbus_service.h" |
21 #include "update_engine/prefs.h" | 21 #include "update_engine/prefs.h" |
22 #include "update_engine/subprocess.h" | 22 #include "update_engine/subprocess.h" |
| 23 #include "update_engine/terminator.h" |
23 #include "update_engine/update_attempter.h" | 24 #include "update_engine/update_attempter.h" |
24 #include "update_engine/update_check_scheduler.h" | 25 #include "update_engine/update_check_scheduler.h" |
25 | 26 |
26 extern "C" { | 27 extern "C" { |
27 #include "update_engine/update_engine.dbusserver.h" | 28 #include "update_engine/update_engine.dbusserver.h" |
28 } | 29 } |
29 | 30 |
30 DEFINE_bool(logtostderr, false, | 31 DEFINE_bool(logtostderr, false, |
31 "Write logs to stderr instead of to a file in log_dir."); | 32 "Write logs to stderr instead of to a file in log_dir."); |
32 DEFINE_bool(foreground, false, | 33 DEFINE_bool(foreground, false, |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 87 |
87 } // namespace chromeos_update_engine | 88 } // namespace chromeos_update_engine |
88 | 89 |
89 #include "update_engine/subprocess.h" | 90 #include "update_engine/subprocess.h" |
90 | 91 |
91 int main(int argc, char** argv) { | 92 int main(int argc, char** argv) { |
92 ::g_type_init(); | 93 ::g_type_init(); |
93 g_thread_init(NULL); | 94 g_thread_init(NULL); |
94 dbus_g_thread_init(); | 95 dbus_g_thread_init(); |
95 base::AtExitManager exit_manager; // Required for base/rand_util.h. | 96 base::AtExitManager exit_manager; // Required for base/rand_util.h. |
| 97 chromeos_update_engine::Terminator::Init(); |
96 chromeos_update_engine::Subprocess::Init(); | 98 chromeos_update_engine::Subprocess::Init(); |
97 google::ParseCommandLineFlags(&argc, &argv, true); | 99 google::ParseCommandLineFlags(&argc, &argv, true); |
98 CommandLine::Init(argc, argv); | 100 CommandLine::Init(argc, argv); |
99 logging::InitLogging("/var/log/update_engine.log", | 101 logging::InitLogging("/var/log/update_engine.log", |
100 (FLAGS_logtostderr ? | 102 (FLAGS_logtostderr ? |
101 logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG : | 103 logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG : |
102 logging::LOG_ONLY_TO_FILE), | 104 logging::LOG_ONLY_TO_FILE), |
103 logging::DONT_LOCK_LOG_FILE, | 105 logging::DONT_LOCK_LOG_FILE, |
104 logging::APPEND_TO_OLD_LOG_FILE); | 106 logging::APPEND_TO_OLD_LOG_FILE); |
105 if (!FLAGS_foreground) | 107 if (!FLAGS_foreground) |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 g_main_loop_run(loop); | 149 g_main_loop_run(loop); |
148 | 150 |
149 // Cleanup: | 151 // Cleanup: |
150 g_main_loop_unref(loop); | 152 g_main_loop_unref(loop); |
151 update_attempter.set_dbus_service(NULL); | 153 update_attempter.set_dbus_service(NULL); |
152 g_object_unref(G_OBJECT(service)); | 154 g_object_unref(G_OBJECT(service)); |
153 | 155 |
154 LOG(INFO) << "Chrome OS Update Engine terminating"; | 156 LOG(INFO) << "Chrome OS Update Engine terminating"; |
155 return 0; | 157 return 0; |
156 } | 158 } |
OLD | NEW |