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): |
Alex Klein | 1699fab | 2022-09-08 08:46:06 -0600 | [diff] [blame] | 12 | """Returns a namespace for the CLI arguments.""" |
| 13 | parser = commandline.ArgumentParser(description=__doc__) |
| 14 | parser.add_argument( |
| 15 | "-i", |
| 16 | "--image_path", |
| 17 | type="path", |
| 18 | required=True, |
| 19 | help="The image to generate the stateful update for.", |
| 20 | ) |
| 21 | parser.add_argument( |
| 22 | "-o", |
| 23 | "--output_dir", |
| 24 | type="path", |
| 25 | required=True, |
| 26 | help="The path to the directory to output the stateful" "update file.", |
| 27 | ) |
| 28 | opts = parser.parse_args(argv) |
| 29 | opts.Freeze() |
Tudor Brindus | 0086f7a | 2018-07-23 16:33:13 -0700 | [diff] [blame] | 30 | |
Alex Klein | 1699fab | 2022-09-08 08:46:06 -0600 | [diff] [blame] | 31 | return opts |
Tudor Brindus | 0086f7a | 2018-07-23 16:33:13 -0700 | [diff] [blame] | 32 | |
| 33 | |
| 34 | def main(argv): |
Alex Klein | 1699fab | 2022-09-08 08:46:06 -0600 | [diff] [blame] | 35 | opts = ParseArguments(argv) |
Tudor Brindus | 0086f7a | 2018-07-23 16:33:13 -0700 | [diff] [blame] | 36 | |
Alex Klein | 1699fab | 2022-09-08 08:46:06 -0600 | [diff] [blame] | 37 | paygen_stateful_payload_lib.GenerateStatefulPayload( |
| 38 | opts.image_path, opts.output_dir |
| 39 | ) |