Parses arguments to script. Returns: A Namespace object containing key values from parser.parse_args()
()
| 9 | |
| 10 | |
| 11 | def parse_arguments(): |
| 12 | """ |
| 13 | Parses arguments to script. |
| 14 | |
| 15 | Returns: |
| 16 | A Namespace object containing key values from parser.parse_args() |
| 17 | """ |
| 18 | parser = argparse.ArgumentParser() |
| 19 | |
| 20 | parser.add_argument( |
| 21 | '-g', |
| 22 | '--gh-json-file', |
| 23 | help='Use file for downloading rootfs images, instead of querying GitHub API directly', |
| 24 | ) |
| 25 | parser.add_argument( |
| 26 | "-i", |
| 27 | "--interactive", |
| 28 | action="store_true", |
| 29 | help="Instead of immediately shutting down upon successful boot, pass 'init=/bin/sh' to the UML executable to allow interacting with UML via a shell.", |
| 30 | ) |
| 31 | parser.add_argument( |
| 32 | "-k", |
| 33 | "--kernel-location", |
| 34 | required=True, |
| 35 | type=str, |
| 36 | help="Path to UML executable ('linux') or kernel build folder to search for executable in. Can be an absolute or relative path.", |
| 37 | ) |
| 38 | |
| 39 | return parser.parse_args() |
| 40 | |
| 41 | |
| 42 | def run_kernel(kernel_image: Path, rootfs: Path, interactive: bool) -> None: |