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