generate_delta_main.cc revision 55c4f9ba7f5c59e3345f2c1869464433ffa8dc2b
1//
2// Copyright (C) 2010 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8//      http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
17#include <errno.h>
18#include <fcntl.h>
19#include <sys/stat.h>
20#include <sys/types.h>
21#include <unistd.h>
22
23#include <set>
24#include <string>
25#include <vector>
26
27#include <base/logging.h>
28#include <base/strings/string_number_conversions.h>
29#include <base/strings/string_split.h>
30#include <brillo/flag_helper.h>
31#include <brillo/key_value_store.h>
32
33#include "update_engine/common/prefs.h"
34#include "update_engine/common/terminator.h"
35#include "update_engine/common/utils.h"
36#include "update_engine/payload_consumer/delta_performer.h"
37#include "update_engine/payload_consumer/payload_constants.h"
38#include "update_engine/payload_generator/delta_diff_generator.h"
39#include "update_engine/payload_generator/delta_diff_utils.h"
40#include "update_engine/payload_generator/payload_generation_config.h"
41#include "update_engine/payload_generator/payload_signer.h"
42#include "update_engine/update_metadata.pb.h"
43
44// This file contains a simple program that takes an old path, a new path,
45// and an output file as arguments and the path to an output file and
46// generates a delta that can be sent to Chrome OS clients.
47
48using std::set;
49using std::string;
50using std::vector;
51
52namespace chromeos_update_engine {
53
54namespace {
55
56void ParseSignatureSizes(const string& signature_sizes_flag,
57                         vector<int>* signature_sizes) {
58  signature_sizes->clear();
59  vector<string> split_strings =
60      base::SplitString(signature_sizes_flag, ":", base::TRIM_WHITESPACE,
61                        base::SPLIT_WANT_ALL);
62  for (const string& str : split_strings) {
63    int size = 0;
64    bool parsing_successful = base::StringToInt(str, &size);
65    LOG_IF(FATAL, !parsing_successful)
66        << "Invalid signature size: " << str;
67
68    LOG_IF(FATAL, size != (2048 / 8)) <<
69        "Only signature sizes of 256 bytes are supported.";
70
71    signature_sizes->push_back(size);
72  }
73}
74
75bool ParseImageInfo(const string& channel,
76                    const string& board,
77                    const string& version,
78                    const string& key,
79                    const string& build_channel,
80                    const string& build_version,
81                    ImageInfo* image_info) {
82  // All of these arguments should be present or missing.
83  bool empty = channel.empty();
84
85  CHECK_EQ(channel.empty(), empty);
86  CHECK_EQ(board.empty(), empty);
87  CHECK_EQ(version.empty(), empty);
88  CHECK_EQ(key.empty(), empty);
89
90  if (empty)
91    return false;
92
93  image_info->set_channel(channel);
94  image_info->set_board(board);
95  image_info->set_version(version);
96  image_info->set_key(key);
97
98  image_info->set_build_channel(
99      build_channel.empty() ? channel : build_channel);
100
101  image_info->set_build_version(
102      build_version.empty() ? version : build_version);
103
104  return true;
105}
106
107void CalculateHashForSigning(const vector<int> &sizes,
108                             const string& out_hash_file,
109                             const string& out_metadata_hash_file,
110                             const string& in_file) {
111  LOG(INFO) << "Calculating hash for signing.";
112  LOG_IF(FATAL, in_file.empty())
113      << "Must pass --in_file to calculate hash for signing.";
114  LOG_IF(FATAL, out_hash_file.empty())
115      << "Must pass --out_hash_file to calculate hash for signing.";
116
117  brillo::Blob payload_hash, metadata_hash;
118  CHECK(PayloadSigner::HashPayloadForSigning(in_file, sizes, &payload_hash,
119                                             &metadata_hash));
120  CHECK(utils::WriteFile(out_hash_file.c_str(), payload_hash.data(),
121                         payload_hash.size()));
122  if (!out_metadata_hash_file.empty())
123    CHECK(utils::WriteFile(out_metadata_hash_file.c_str(), metadata_hash.data(),
124                           metadata_hash.size()));
125
126  LOG(INFO) << "Done calculating hash for signing.";
127}
128
129void SignatureFileFlagToBlobs(const string& signature_file_flag,
130                              vector<brillo::Blob>* signatures) {
131  vector<string> signature_files =
132      base::SplitString(signature_file_flag, ":", base::TRIM_WHITESPACE,
133                        base::SPLIT_WANT_ALL);
134  for (const string& signature_file : signature_files) {
135    brillo::Blob signature;
136    CHECK(utils::ReadFile(signature_file, &signature));
137    signatures->push_back(signature);
138  }
139}
140
141void SignPayload(const string& in_file,
142                 const string& out_file,
143                 const string& payload_signature_file,
144                 const string& metadata_signature_file,
145                 const string& out_metadata_size_file) {
146  LOG(INFO) << "Signing payload.";
147  LOG_IF(FATAL, in_file.empty())
148      << "Must pass --in_file to sign payload.";
149  LOG_IF(FATAL, out_file.empty())
150      << "Must pass --out_file to sign payload.";
151  LOG_IF(FATAL, payload_signature_file.empty())
152      << "Must pass --signature_file to sign payload.";
153  vector<brillo::Blob> signatures, metadata_signatures;
154  SignatureFileFlagToBlobs(payload_signature_file, &signatures);
155  SignatureFileFlagToBlobs(metadata_signature_file, &metadata_signatures);
156  uint64_t final_metadata_size;
157  CHECK(PayloadSigner::AddSignatureToPayload(in_file, signatures,
158      metadata_signatures, out_file, &final_metadata_size));
159  LOG(INFO) << "Done signing payload. Final metadata size = "
160            << final_metadata_size;
161  if (!out_metadata_size_file.empty()) {
162    string metadata_size_string = std::to_string(final_metadata_size);
163    CHECK(utils::WriteFile(out_metadata_size_file.c_str(),
164                           metadata_size_string.data(),
165                           metadata_size_string.size()));
166  }
167}
168
169void VerifySignedPayload(const string& in_file,
170                         const string& public_key) {
171  LOG(INFO) << "Verifying signed payload.";
172  LOG_IF(FATAL, in_file.empty())
173      << "Must pass --in_file to verify signed payload.";
174  LOG_IF(FATAL, public_key.empty())
175      << "Must pass --public_key to verify signed payload.";
176  CHECK(PayloadSigner::VerifySignedPayload(in_file, public_key));
177  LOG(INFO) << "Done verifying signed payload.";
178}
179
180// TODO(deymo): This function is likely broken for deltas minor version 2 or
181// newer. Move this function to a new file and make the delta_performer
182// integration tests use this instead.
183void ApplyDelta(const string& in_file,
184                const string& old_kernel,
185                const string& old_rootfs,
186                const string& prefs_dir) {
187  LOG(INFO) << "Applying delta.";
188  LOG_IF(FATAL, old_rootfs.empty())
189      << "Must pass --old_image to apply delta.";
190  Prefs prefs;
191  InstallPlan install_plan;
192  LOG(INFO) << "Setting up preferences under: " << prefs_dir;
193  LOG_IF(ERROR, !prefs.Init(base::FilePath(prefs_dir)))
194      << "Failed to initialize preferences.";
195  // Get original checksums
196  LOG(INFO) << "Calculating original checksums";
197  ImageConfig old_image;
198  old_image.partitions.emplace_back(kLegacyPartitionNameRoot);
199  old_image.partitions.back().path = old_rootfs;
200  old_image.partitions.emplace_back(kLegacyPartitionNameKernel);
201  old_image.partitions.back().path = old_kernel;
202  CHECK(old_image.LoadImageSize());
203  for (const auto& old_part : old_image.partitions) {
204    PartitionInfo part_info;
205    CHECK(diff_utils::InitializePartitionInfo(old_part, &part_info));
206    InstallPlan::Partition part;
207    part.name = old_part.name;
208    part.source_hash.assign(part_info.hash().begin(),
209                            part_info.hash().end());
210    part.source_path = old_part.path;
211    // Apply the delta in-place to the old_part.
212    part.target_path = old_part.path;
213    install_plan.partitions.push_back(part);
214  }
215
216  DeltaPerformer performer(&prefs, nullptr, nullptr, nullptr, &install_plan);
217  brillo::Blob buf(1024 * 1024);
218  int fd = open(in_file.c_str(), O_RDONLY, 0);
219  CHECK_GE(fd, 0);
220  ScopedFdCloser fd_closer(&fd);
221  for (off_t offset = 0;; offset += buf.size()) {
222    ssize_t bytes_read;
223    CHECK(utils::PReadAll(fd, buf.data(), buf.size(), offset, &bytes_read));
224    if (bytes_read == 0)
225      break;
226    CHECK_EQ(performer.Write(buf.data(), bytes_read), bytes_read);
227  }
228  CHECK_EQ(performer.Close(), 0);
229  DeltaPerformer::ResetUpdateProgress(&prefs, false);
230  LOG(INFO) << "Done applying delta.";
231}
232
233int ExtractProperties(const string& payload_path, const string& props_file) {
234  brillo::KeyValueStore properties;
235  TEST_AND_RETURN_FALSE(
236      PayloadSigner::ExtractPayloadProperties(payload_path, &properties));
237  if (props_file == "-") {
238    printf("%s", properties.SaveToString().c_str());
239  } else {
240    properties.Save(base::FilePath(props_file));
241    LOG(INFO) << "Generated properties file at " << props_file;
242  }
243  return true;
244}
245
246int Main(int argc, char** argv) {
247  DEFINE_string(old_image, "", "Path to the old rootfs");
248  DEFINE_string(new_image, "", "Path to the new rootfs");
249  DEFINE_string(old_kernel, "", "Path to the old kernel partition image");
250  DEFINE_string(new_kernel, "", "Path to the new kernel partition image");
251  DEFINE_string(old_partitions, "",
252                "Path to the old partitions. To pass multiple partitions, use "
253                "a single argument with a colon between paths, e.g. "
254                "/path/to/part:/path/to/part2::/path/to/last_part . Path can "
255                "be empty, but it has to match the order of partition_names.");
256  DEFINE_string(new_partitions, "",
257                "Path to the new partitions. To pass multiple partitions, use "
258                "a single argument with a colon between paths, e.g. "
259                "/path/to/part:/path/to/part2:/path/to/last_part . Path has "
260                "to match the order of partition_names.");
261  DEFINE_string(partition_names,
262                string(kLegacyPartitionNameRoot) + ":" +
263                kLegacyPartitionNameKernel,
264                "Names of the partitions. To pass multiple names, use a single "
265                "argument with a colon between names, e.g. "
266                "name:name2:name3:last_name . Name can not be empty, and it "
267                "has to match the order of partitions.");
268  DEFINE_string(in_file, "",
269                "Path to input delta payload file used to hash/sign payloads "
270                "and apply delta over old_image (for debugging)");
271  DEFINE_string(out_file, "", "Path to output delta payload file");
272  DEFINE_string(out_hash_file, "", "Path to output hash file");
273  DEFINE_string(out_metadata_hash_file, "",
274                "Path to output metadata hash file");
275  DEFINE_string(out_metadata_size_file, "",
276                "Path to output metadata size file");
277  DEFINE_string(private_key, "", "Path to private key in .pem format");
278  DEFINE_string(public_key, "", "Path to public key in .pem format");
279  DEFINE_int32(public_key_version, -1,
280               "DEPRECATED. Key-check version # of client");
281  DEFINE_string(prefs_dir, "/tmp/update_engine_prefs",
282                "Preferences directory, used with apply_delta");
283  DEFINE_string(signature_size, "",
284                "Raw signature size used for hash calculation. "
285                "You may pass in multiple sizes by colon separating them. E.g. "
286                "2048:2048:4096 will assume 3 signatures, the first two with "
287                "2048 size and the last 4096.");
288  DEFINE_string(signature_file, "",
289                "Raw signature file to sign payload with. To pass multiple "
290                "signatures, use a single argument with a colon between paths, "
291                "e.g. /path/to/sig:/path/to/next:/path/to/last_sig . Each "
292                "signature will be assigned a client version, starting from "
293                "kSignatureOriginalVersion.");
294  DEFINE_string(metadata_signature_file, "",
295                "Raw signature file with the signature of the metadata hash. "
296                "To pass multiple signatures, use a single argument with a "
297                "colon between paths, "
298                "e.g. /path/to/sig:/path/to/next:/path/to/last_sig .");
299  DEFINE_int32(chunk_size, 200 * 1024 * 1024,
300               "Payload chunk size (-1 for whole files)");
301  DEFINE_uint64(rootfs_partition_size,
302               chromeos_update_engine::kRootFSPartitionSize,
303               "RootFS partition size for the image once installed");
304  DEFINE_uint64(major_version, 1,
305               "The major version of the payload being generated.");
306  DEFINE_int32(minor_version, -1,
307               "The minor version of the payload being generated "
308               "(-1 means autodetect).");
309  DEFINE_string(properties_file, "",
310                "If passed, dumps the payload properties of the payload passed "
311                "in --in_file and exits.");
312
313  DEFINE_string(old_channel, "",
314                "The channel for the old image. 'dev-channel', 'npo-channel', "
315                "etc. Ignored, except during delta generation.");
316  DEFINE_string(old_board, "",
317                "The board for the old image. 'x86-mario', 'lumpy', "
318                "etc. Ignored, except during delta generation.");
319  DEFINE_string(old_version, "",
320                "The build version of the old image. 1.2.3, etc.");
321  DEFINE_string(old_key, "",
322                "The key used to sign the old image. 'premp', 'mp', 'mp-v3',"
323                " etc");
324  DEFINE_string(old_build_channel, "",
325                "The channel for the build of the old image. 'dev-channel', "
326                "etc, but will never contain special channels such as "
327                "'npo-channel'. Ignored, except during delta generation.");
328  DEFINE_string(old_build_version, "",
329                "The version of the build containing the old image.");
330
331  DEFINE_string(new_channel, "",
332                "The channel for the new image. 'dev-channel', 'npo-channel', "
333                "etc. Ignored, except during delta generation.");
334  DEFINE_string(new_board, "",
335                "The board for the new image. 'x86-mario', 'lumpy', "
336                "etc. Ignored, except during delta generation.");
337  DEFINE_string(new_version, "",
338                "The build version of the new image. 1.2.3, etc.");
339  DEFINE_string(new_key, "",
340                "The key used to sign the new image. 'premp', 'mp', 'mp-v3',"
341                " etc");
342  DEFINE_string(new_build_channel, "",
343                "The channel for the build of the new image. 'dev-channel', "
344                "etc, but will never contain special channels such as "
345                "'npo-channel'. Ignored, except during delta generation.");
346  DEFINE_string(new_build_version, "",
347                "The version of the build containing the new image.");
348  DEFINE_string(new_postinstall_config_file, "",
349                "A config file specifying postinstall related metadata. "
350                "Only allowed in major version 2 or newer.");
351
352  brillo::FlagHelper::Init(argc, argv,
353      "Generates a payload to provide to ChromeOS' update_engine.\n\n"
354      "This tool can create full payloads and also delta payloads if the src\n"
355      "image is provided. It also provides debugging options to apply, sign\n"
356      "and verify payloads.");
357  Terminator::Init();
358
359  logging::LoggingSettings log_settings;
360  log_settings.log_file     = "delta_generator.log";
361  log_settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
362  log_settings.lock_log     = logging::LOCK_LOG_FILE;
363  log_settings.delete_old   = logging::APPEND_TO_OLD_LOG_FILE;
364
365  logging::InitLogging(log_settings);
366
367  vector<int> signature_sizes;
368  ParseSignatureSizes(FLAGS_signature_size, &signature_sizes);
369
370  if (!FLAGS_out_hash_file.empty() || !FLAGS_out_metadata_hash_file.empty()) {
371    CHECK(FLAGS_out_metadata_size_file.empty());
372    CalculateHashForSigning(signature_sizes, FLAGS_out_hash_file,
373                            FLAGS_out_metadata_hash_file, FLAGS_in_file);
374    return 0;
375  }
376  if (!FLAGS_signature_file.empty()) {
377    SignPayload(FLAGS_in_file, FLAGS_out_file, FLAGS_signature_file,
378                FLAGS_metadata_signature_file, FLAGS_out_metadata_size_file);
379    return 0;
380  }
381  if (!FLAGS_public_key.empty()) {
382    LOG_IF(WARNING, FLAGS_public_key_version != -1)
383        << "--public_key_version is deprecated and ignored.";
384    VerifySignedPayload(FLAGS_in_file, FLAGS_public_key);
385    return 0;
386  }
387  if (!FLAGS_properties_file.empty()) {
388    return ExtractProperties(FLAGS_in_file, FLAGS_properties_file) ? 0 : 1;
389  }
390  if (!FLAGS_in_file.empty()) {
391    ApplyDelta(FLAGS_in_file, FLAGS_old_kernel, FLAGS_old_image,
392               FLAGS_prefs_dir);
393    return 0;
394  }
395
396  // A payload generation was requested. Convert the flags to a
397  // PayloadGenerationConfig.
398  PayloadGenerationConfig payload_config;
399  vector<string> partition_names, old_partitions, new_partitions;
400
401  partition_names =
402      base::SplitString(FLAGS_partition_names, ":", base::TRIM_WHITESPACE,
403                        base::SPLIT_WANT_ALL);
404  CHECK(!partition_names.empty());
405  if (FLAGS_major_version == kChromeOSMajorPayloadVersion ||
406      FLAGS_new_partitions.empty()) {
407    LOG_IF(FATAL, partition_names.size() != 2)
408        << "To support more than 2 partitions, please use the "
409        << "--new_partitions flag and major version 2.";
410    LOG_IF(FATAL, partition_names[0] != kLegacyPartitionNameRoot ||
411                  partition_names[1] != kLegacyPartitionNameKernel)
412        << "To support non-default partition name, please use the "
413        << "--new_partitions flag and major version 2.";
414  }
415
416  if (!FLAGS_new_partitions.empty()) {
417    LOG_IF(FATAL, !FLAGS_new_image.empty() || !FLAGS_new_kernel.empty())
418        << "--new_image and --new_kernel are deprecated, please use "
419        << "--new_partitions for all partitions.";
420    new_partitions =
421        base::SplitString(FLAGS_new_partitions, ":", base::TRIM_WHITESPACE,
422                          base::SPLIT_WANT_ALL);
423    CHECK(partition_names.size() == new_partitions.size());
424
425    payload_config.is_delta = !FLAGS_old_partitions.empty();
426    LOG_IF(FATAL, !FLAGS_old_image.empty() || !FLAGS_old_kernel.empty())
427        << "--old_image and --old_kernel are deprecated, please use "
428        << "--old_partitions if you are using --new_partitions.";
429  } else {
430    new_partitions = {FLAGS_new_image, FLAGS_new_kernel};
431    LOG(WARNING) << "--new_partitions is empty, using deprecated --new_image "
432                 << "and --new_kernel flags.";
433
434    payload_config.is_delta = !FLAGS_old_image.empty() ||
435                              !FLAGS_old_kernel.empty();
436    LOG_IF(FATAL, !FLAGS_old_partitions.empty())
437        << "Please use --new_partitions if you are using --old_partitions.";
438  }
439  for (size_t i = 0; i < partition_names.size(); i++) {
440    LOG_IF(FATAL, partition_names[i].empty())
441        << "Partition name can't be empty, see --partition_names.";
442    payload_config.target.partitions.emplace_back(partition_names[i]);
443    payload_config.target.partitions.back().path = new_partitions[i];
444  }
445
446  if (payload_config.is_delta) {
447    if (!FLAGS_old_partitions.empty()) {
448      old_partitions =
449          base::SplitString(FLAGS_old_partitions, ":", base::TRIM_WHITESPACE,
450                            base::SPLIT_WANT_ALL);
451      CHECK(old_partitions.size() == new_partitions.size());
452    } else {
453      old_partitions = {FLAGS_old_image, FLAGS_old_kernel};
454      LOG(WARNING) << "--old_partitions is empty, using deprecated --old_image "
455                   << "and --old_kernel flags.";
456    }
457    for (size_t i = 0; i < partition_names.size(); i++) {
458      payload_config.source.partitions.emplace_back(partition_names[i]);
459      payload_config.source.partitions.back().path = old_partitions[i];
460    }
461  }
462
463  if (!FLAGS_new_postinstall_config_file.empty()) {
464    LOG_IF(FATAL, FLAGS_major_version == kChromeOSMajorPayloadVersion)
465        << "Postinstall config is only allowed in major version 2 or newer.";
466    brillo::KeyValueStore store;
467    CHECK(store.Load(base::FilePath(FLAGS_new_postinstall_config_file)));
468    CHECK(payload_config.target.LoadPostInstallConfig(store));
469  }
470
471  // Use the default soft_chunk_size defined in the config.
472  payload_config.hard_chunk_size = FLAGS_chunk_size;
473  payload_config.block_size = kBlockSize;
474
475  // The partition size is never passed to the delta_generator, so we
476  // need to detect those from the provided files.
477  if (payload_config.is_delta) {
478    CHECK(payload_config.source.LoadImageSize());
479  }
480  CHECK(payload_config.target.LoadImageSize());
481
482  CHECK(!FLAGS_out_file.empty());
483
484  // Ignore failures. These are optional arguments.
485  ParseImageInfo(FLAGS_new_channel,
486                 FLAGS_new_board,
487                 FLAGS_new_version,
488                 FLAGS_new_key,
489                 FLAGS_new_build_channel,
490                 FLAGS_new_build_version,
491                 &payload_config.target.image_info);
492
493  // Ignore failures. These are optional arguments.
494  ParseImageInfo(FLAGS_old_channel,
495                 FLAGS_old_board,
496                 FLAGS_old_version,
497                 FLAGS_old_key,
498                 FLAGS_old_build_channel,
499                 FLAGS_old_build_version,
500                 &payload_config.source.image_info);
501
502  payload_config.rootfs_partition_size = FLAGS_rootfs_partition_size;
503
504  if (payload_config.is_delta) {
505    // Avoid opening the filesystem interface for full payloads.
506    for (PartitionConfig& part : payload_config.target.partitions)
507      CHECK(part.OpenFilesystem());
508    for (PartitionConfig& part : payload_config.source.partitions)
509      CHECK(part.OpenFilesystem());
510  }
511
512  payload_config.major_version = FLAGS_major_version;
513  LOG(INFO) << "Using provided major_version=" << FLAGS_major_version;
514
515  if (FLAGS_minor_version == -1) {
516    // Autodetect minor_version by looking at the update_engine.conf in the old
517    // image.
518    if (payload_config.is_delta) {
519      payload_config.minor_version = kInPlaceMinorPayloadVersion;
520      brillo::KeyValueStore store;
521      uint32_t minor_version;
522      for (const PartitionConfig& part : payload_config.source.partitions) {
523        if (part.fs_interface && part.fs_interface->LoadSettings(&store) &&
524            utils::GetMinorVersion(store, &minor_version)) {
525          payload_config.minor_version = minor_version;
526          break;
527        }
528      }
529    } else {
530      payload_config.minor_version = kFullPayloadMinorVersion;
531    }
532    LOG(INFO) << "Auto-detected minor_version=" << payload_config.minor_version;
533  } else {
534    payload_config.minor_version = FLAGS_minor_version;
535    LOG(INFO) << "Using provided minor_version=" << FLAGS_minor_version;
536  }
537
538  if (payload_config.minor_version >= kImgdiffMinorPayloadVersion) {
539    // TODO(senj): Check if the zlib version in source and target are the same.
540    payload_config.imgdiff_allowed = true;
541  }
542
543  if (payload_config.is_delta) {
544    LOG(INFO) << "Generating delta update";
545  } else {
546    LOG(INFO) << "Generating full update";
547  }
548
549  // From this point, all the options have been parsed.
550  if (!payload_config.Validate()) {
551    LOG(ERROR) << "Invalid options passed. See errors above.";
552    return 1;
553  }
554
555  uint64_t metadata_size;
556  if (!GenerateUpdatePayloadFile(payload_config,
557                                 FLAGS_out_file,
558                                 FLAGS_private_key,
559                                 &metadata_size)) {
560    return 1;
561  }
562  if (!FLAGS_out_metadata_size_file.empty()) {
563    string metadata_size_string = std::to_string(metadata_size);
564    CHECK(utils::WriteFile(FLAGS_out_metadata_size_file.c_str(),
565                           metadata_size_string.data(),
566                           metadata_size_string.size()));
567  }
568  return 0;
569}
570
571}  // namespace
572
573}  // namespace chromeos_update_engine
574
575int main(int argc, char** argv) {
576  return chromeos_update_engine::Main(argc, argv);
577}
578