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 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 ssize_t bytes_read; | 85 ssize_t bytes_read; |
86 CHECK(utils::PReadAll(fd, &buf[0], buf.size(), offset, &bytes_read)); | 86 CHECK(utils::PReadAll(fd, &buf[0], buf.size(), offset, &bytes_read)); |
87 if (bytes_read == 0) | 87 if (bytes_read == 0) |
88 break; | 88 break; |
89 CHECK_EQ(performer.Write(&buf[0], bytes_read), bytes_read); | 89 CHECK_EQ(performer.Write(&buf[0], bytes_read), bytes_read); |
90 } | 90 } |
91 CHECK_EQ(performer.Close(), 0); | 91 CHECK_EQ(performer.Close(), 0); |
92 LOG(INFO) << "done applying delta."; | 92 LOG(INFO) << "done applying delta."; |
93 return 0; | 93 return 0; |
94 } | 94 } |
95 CHECK(!FLAGS_old_dir.empty()); | |
96 CHECK(!FLAGS_new_dir.empty()); | |
97 CHECK(!FLAGS_old_image.empty()); | |
98 CHECK(!FLAGS_new_image.empty()); | 95 CHECK(!FLAGS_new_image.empty()); |
99 CHECK(!FLAGS_out_file.empty()); | 96 CHECK(!FLAGS_out_file.empty()); |
100 CHECK(!FLAGS_old_kernel.empty()); | |
101 CHECK(!FLAGS_new_kernel.empty()); | 97 CHECK(!FLAGS_new_kernel.empty()); |
102 if ((!IsDir(FLAGS_old_dir.c_str())) || (!IsDir(FLAGS_new_dir.c_str()))) { | 98 if (FLAGS_old_image.empty()) { |
103 LOG(FATAL) << "old_dir or new_dir not directory"; | 99 LOG(INFO) << "Generating full update"; |
| 100 } else { |
| 101 LOG(INFO) << "Generating delta update"; |
| 102 CHECK(!FLAGS_old_kernel.empty()); |
| 103 CHECK(!FLAGS_old_dir.empty()); |
| 104 CHECK(!FLAGS_new_dir.empty()); |
| 105 if ((!IsDir(FLAGS_old_dir.c_str())) || (!IsDir(FLAGS_new_dir.c_str()))) { |
| 106 LOG(FATAL) << "old_dir or new_dir not directory"; |
| 107 } |
104 } | 108 } |
105 | |
106 DeltaDiffGenerator::GenerateDeltaUpdateFile(FLAGS_old_dir, | 109 DeltaDiffGenerator::GenerateDeltaUpdateFile(FLAGS_old_dir, |
107 FLAGS_old_image, | 110 FLAGS_old_image, |
108 FLAGS_new_dir, | 111 FLAGS_new_dir, |
109 FLAGS_new_image, | 112 FLAGS_new_image, |
110 FLAGS_old_kernel, | 113 FLAGS_old_kernel, |
111 FLAGS_new_kernel, | 114 FLAGS_new_kernel, |
112 FLAGS_out_file, | 115 FLAGS_out_file, |
113 FLAGS_private_key); | 116 FLAGS_private_key); |
114 | 117 |
115 return 0; | 118 return 0; |
116 } | 119 } |
117 | 120 |
118 } // namespace {} | 121 } // namespace {} |
119 | 122 |
120 } // namespace chromeos_update_engine | 123 } // namespace chromeos_update_engine |
121 | 124 |
122 int main(int argc, char** argv) { | 125 int main(int argc, char** argv) { |
123 return chromeos_update_engine::Main(argc, argv); | 126 return chromeos_update_engine::Main(argc, argv); |
124 } | 127 } |
OLD | NEW |