blob: 580adcc49de540dab8b10f5755bf4de7de79428c [file] [log] [blame]
# Copyright 2018 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Script to generate a Chromium OS update for use by the update engine.
If a source .bin is specified, the update is assumed to be a delta update.
import logging
from chromite.lib import commandline
from chromite.lib.paygen import paygen_payload_lib
def ParseArguments(argv):
"""Returns a namespace for the CLI arguments."""
parser = commandline.ArgumentParser(description=__doc__)
help='The path (to local disk or Google Storage Bucket)'
' of the target image to build the payload for.')
help='The path (to local disk or Google Storage Bucket)'
' of the source image. If specified, this makes a delta'
' update payload.')
parser.add_argument('--output', type='path', help='Output file.')
parser.add_argument('--private-key', type='path',
help='Path to private key in .pem format.')
parser.add_argument('--check', action='store_true',
help='If passed, verifies the integrity of the payload')
parser.add_argument('--extract', action='store_true',
help='If set, extract old/new kernel/rootfs to '
'[old|new]_[kern|root].dat. Useful for debugging.')
parser.add_argument('--minios', action='store_true',
help='If set, extract the miniOS partition, otherwise '
'extract the kernel and rootfs partitions.')
parser.add_argument('--work-dir', type='path',
help='Path to a temporary directory in the chroot.')
parser.add_argument('--payload', type='path',
help='Path to the input payload file. Only used when '
'trying to generate the payload properties file using '
'the given payload. If --output is not passed, the '
'payload properties file path will be generated by '
'appending .json to the payload filename itself.')
opts = parser.parse_args(argv)
return opts
def main(argv):
opts = ParseArguments(argv)
if opts.payload:
# We only want the payload's metadata. Create it and exit.'Generating payload properties file.')
return not paygen_payload_lib.GenerateUpdatePayload(
opts.tgt_image, opts.output, src_image=opts.src_image,
work_dir=opts.work_dir, private_key=opts.private_key, check=opts.check,