| 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 <sys/types.h> | 5 #include <sys/types.h> |
| 6 #include <sys/stat.h> | 6 #include <sys/stat.h> |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <unistd.h> | 9 #include <unistd.h> |
| 10 | 10 |
| 11 #include <set> | 11 #include <set> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include <base/command_line.h> | 15 #include <base/command_line.h> |
| 16 #include <base/logging.h> | 16 #include <base/logging.h> |
| 17 #include <gflags/gflags.h> | 17 #include <gflags/gflags.h> |
| 18 #include <glib.h> | 18 #include <glib.h> |
| 19 | 19 |
| 20 #include "update_engine/delta_diff_generator.h" | 20 #include "update_engine/delta_diff_generator.h" |
| 21 #include "update_engine/delta_performer.h" | 21 #include "update_engine/delta_performer.h" |
| 22 #include "update_engine/prefs.h" | 22 #include "update_engine/prefs.h" |
| 23 #include "update_engine/subprocess.h" | 23 #include "update_engine/subprocess.h" |
| 24 #include "update_engine/terminator.h" |
| 24 #include "update_engine/update_metadata.pb.h" | 25 #include "update_engine/update_metadata.pb.h" |
| 25 #include "update_engine/utils.h" | 26 #include "update_engine/utils.h" |
| 26 | 27 |
| 27 DEFINE_string(old_dir, "", | 28 DEFINE_string(old_dir, "", |
| 28 "Directory where the old rootfs is loop mounted read-only"); | 29 "Directory where the old rootfs is loop mounted read-only"); |
| 29 DEFINE_string(new_dir, "", | 30 DEFINE_string(new_dir, "", |
| 30 "Directory where the new rootfs is loop mounted read-only"); | 31 "Directory where the new rootfs is loop mounted read-only"); |
| 31 DEFINE_string(old_image, "", "Path to the old rootfs"); | 32 DEFINE_string(old_image, "", "Path to the old rootfs"); |
| 32 DEFINE_string(new_image, "", "Path to the new rootfs"); | 33 DEFINE_string(new_image, "", "Path to the new rootfs"); |
| 33 DEFINE_string(out_file, "", "Path to output file"); | 34 DEFINE_string(out_file, "", "Path to output file"); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 54 bool IsDir(const char* path) { | 55 bool IsDir(const char* path) { |
| 55 struct stat stbuf; | 56 struct stat stbuf; |
| 56 TEST_AND_RETURN_FALSE_ERRNO(lstat(path, &stbuf) == 0); | 57 TEST_AND_RETURN_FALSE_ERRNO(lstat(path, &stbuf) == 0); |
| 57 return S_ISDIR(stbuf.st_mode); | 58 return S_ISDIR(stbuf.st_mode); |
| 58 } | 59 } |
| 59 | 60 |
| 60 int Main(int argc, char** argv) { | 61 int Main(int argc, char** argv) { |
| 61 g_thread_init(NULL); | 62 g_thread_init(NULL); |
| 62 google::ParseCommandLineFlags(&argc, &argv, true); | 63 google::ParseCommandLineFlags(&argc, &argv, true); |
| 63 CommandLine::Init(argc, argv); | 64 CommandLine::Init(argc, argv); |
| 65 Terminator::Init(); |
| 64 Subprocess::Init(); | 66 Subprocess::Init(); |
| 65 logging::InitLogging("delta_generator.log", | 67 logging::InitLogging("delta_generator.log", |
| 66 logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, | 68 logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, |
| 67 logging::DONT_LOCK_LOG_FILE, | 69 logging::DONT_LOCK_LOG_FILE, |
| 68 logging::APPEND_TO_OLD_LOG_FILE); | 70 logging::APPEND_TO_OLD_LOG_FILE); |
| 69 if (!FLAGS_apply_delta.empty()) { | 71 if (!FLAGS_apply_delta.empty()) { |
| 70 if (FLAGS_old_image.empty()) { | 72 if (FLAGS_old_image.empty()) { |
| 71 LOG(FATAL) << "Must pass --old_image with --apply_delta."; | 73 LOG(FATAL) << "Must pass --old_image with --apply_delta."; |
| 72 } | 74 } |
| 73 Prefs prefs; | 75 Prefs prefs; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 return 0; | 117 return 0; |
| 116 } | 118 } |
| 117 | 119 |
| 118 } // namespace {} | 120 } // namespace {} |
| 119 | 121 |
| 120 } // namespace chromeos_update_engine | 122 } // namespace chromeos_update_engine |
| 121 | 123 |
| 122 int main(int argc, char** argv) { | 124 int main(int argc, char** argv) { |
| 123 return chromeos_update_engine::Main(argc, argv); | 125 return chromeos_update_engine::Main(argc, argv); |
| 124 } | 126 } |
| OLD | NEW |