diff options
Diffstat (limited to 'scripts/lib-boot-args.sh')
| -rw-r--r-- | scripts/lib-boot-args.sh | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/scripts/lib-boot-args.sh b/scripts/lib-boot-args.sh deleted file mode 100644 index ec97500..0000000 --- a/scripts/lib-boot-args.sh +++ /dev/null | |||
| @@ -1,38 +0,0 @@ | |||
| 1 | #!/usr/bin/env bash | ||
| 2 | # | ||
| 3 | # scripts/lib-boot-args.sh — shared CLI parsing for the QEMU boot scripts. | ||
| 4 | # Sourced, not executed. The caller sets default values for GUI/DEBUG/ | ||
| 5 | # MEM/SMP first, then calls `parse_boot_args "$@"`. A caller with extra | ||
| 6 | # flags defines its own `handle_arg()` to intercept them before the | ||
| 7 | # shared cases run (unknown args still fail loudly). | ||
| 8 | set -euo pipefail | ||
| 9 | |||
| 10 | parse_boot_args() { | ||
| 11 | while [ $# -gt 0 ]; do | ||
| 12 | case "$1" in | ||
| 13 | --gui | -g) GUI="-vga std" ;; | ||
| 14 | --debug | -d) DEBUG="-s -S" ;; | ||
| 15 | --mem) | ||
| 16 | shift | ||
| 17 | MEM="$1" | ||
| 18 | ;; | ||
| 19 | --smp) | ||
| 20 | shift | ||
| 21 | SMP="$1" | ||
| 22 | ;; | ||
| 23 | --help | -h) | ||
| 24 | head -20 "$0" | grep "^#" | sed 's/^# //' | ||
| 25 | exit 0 | ||
| 26 | ;; | ||
| 27 | *) handle_arg "$1" ;; | ||
| 28 | esac | ||
| 29 | shift | ||
| 30 | done | ||
| 31 | } | ||
| 32 | |||
| 33 | # Default: no extra flags. A script with more defines its own before | ||
| 34 | # calling parse_boot_args. | ||
| 35 | handle_arg() { | ||
| 36 | echo "unknown: $1" | ||
| 37 | exit 1 | ||
| 38 | } | ||
