blob: 93d3fd2d66673adec4b5d408596a89b3ec93f1d9 [file] [log] [blame]
Tudor Brindus0086f7a2018-07-23 16:33:13 -07001# 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 Brindus0086f7a2018-07-23 16:33:13 -07007from chromite.lib import commandline
Amin Hassania2a83382019-01-09 12:36:54 -08008from chromite.lib.paygen import paygen_stateful_payload_lib
Tudor Brindus0086f7a2018-07-23 16:33:13 -07009
10
11def ParseArguments(argv):
Alex Klein1699fab2022-09-08 08:46:06 -060012 """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 Brindus0086f7a2018-07-23 16:33:13 -070030
Alex Klein1699fab2022-09-08 08:46:06 -060031 return opts
Tudor Brindus0086f7a2018-07-23 16:33:13 -070032
33
34def main(argv):
Alex Klein1699fab2022-09-08 08:46:06 -060035 opts = ParseArguments(argv)
Tudor Brindus0086f7a2018-07-23 16:33:13 -070036
Alex Klein1699fab2022-09-08 08:46:06 -060037 paygen_stateful_payload_lib.GenerateStatefulPayload(
38 opts.image_path, opts.output_dir
39 )