Tudor Brindus | 0086f7a | 2018-07-23 16:33:13 -0700 | [diff] [blame] | 1 | # -*- coding: utf-8 -*- |
| 2 | # Copyright 2018 The Chromium OS Authors. All rights reserved. |
| 3 | # Use of this source code is governed by a BSD-style license that can be |
| 4 | # found in the LICENSE file. |
| 5 | |
| 6 | """This module is responsible for generating a stateful update payload.""" |
| 7 | |
| 8 | from __future__ import print_function |
| 9 | |
Tudor Brindus | 0086f7a | 2018-07-23 16:33:13 -0700 | [diff] [blame] | 10 | from chromite.lib import commandline |
Tudor Brindus | 0086f7a | 2018-07-23 16:33:13 -0700 | [diff] [blame] | 11 | |
Amin Hassani | a2a8338 | 2019-01-09 12:36:54 -0800 | [diff] [blame^] | 12 | from chromite.lib.paygen import paygen_stateful_payload_lib |
Tudor Brindus | 0086f7a | 2018-07-23 16:33:13 -0700 | [diff] [blame] | 13 | |
| 14 | |
| 15 | def ParseArguments(argv): |
| 16 | """Returns a namespace for the CLI arguments.""" |
| 17 | parser = commandline.ArgumentParser(description=__doc__) |
| 18 | parser.add_argument('-i', '--image_path', type='path', required=True, |
| 19 | help='The image to generate the stateful update for.') |
| 20 | parser.add_argument('-o', '--output_dir', type='path', required=True, |
| 21 | help='The path to the directory to output the stateful' |
| 22 | 'update file.') |
| 23 | opts = parser.parse_args(argv) |
| 24 | opts.Freeze() |
| 25 | |
| 26 | return opts |
| 27 | |
| 28 | |
| 29 | def main(argv): |
| 30 | opts = ParseArguments(argv) |
| 31 | |
Amin Hassani | a2a8338 | 2019-01-09 12:36:54 -0800 | [diff] [blame^] | 32 | paygen_stateful_payload_lib.GenerateStatefulPayload(opts.image_path, |
| 33 | opts.output_dir) |