summaryrefslogtreecommitdiffstats
path: root/scripts/lib-boot-args.sh
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-08-01 18:25:55 +0200
committersalmonik <salmonik@tuta.io>2026-08-01 18:25:55 +0200
commit1ea2f68e6a9af135e6cb3274fdf28d4ddc5812d5 (patch)
treef28246586e387293d0c8beaf6b445210aaab8c48 /scripts/lib-boot-args.sh
parentklog/tty/pager: no more truncated lines — full lines flow, terminal wraps (diff)
downloadrs-dos-1ea2f68e6a9af135e6cb3274fdf28d4ddc5812d5.tar.gz
rs-dos-1ea2f68e6a9af135e6cb3274fdf28d4ddc5812d5.zip
fix pi-lens warnings: unwraps, shell SC2046, dup code (fmtbuf/scripts/hexdump/cat/ahci/pci)
- memory.rs: self-test Layout::from_size_align no longer panics — the test fails cleanly on an invalid layout - fat.rs: v() no longer unwraps the active-volume slot — invariant violation logs + halts instead of panicking mid-disk-io - strbuf: shared FmtBuf replaces the duplicated PanicBuf/FmtBuf (main.rs + sched.rs) - test-disk.sh: SC2046 — conditional --fresh arg no longer relies on word splitting - scripts: boot.sh/boot-image.sh share lib-boot-args.sh (dup args loop) - shell: cat/hexdump stdin pairs unified with Option<&str> marker; hexdump format_row folded into format_partial - ahci: read/write_sectors unified behind dma_sectors - pci: config_read/write share config_addr
Diffstat (limited to 'scripts/lib-boot-args.sh')
-rw-r--r--scripts/lib-boot-args.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/scripts/lib-boot-args.sh b/scripts/lib-boot-args.sh
new file mode 100644
index 0000000..ec97500
--- /dev/null
+++ b/scripts/lib-boot-args.sh
@@ -0,0 +1,38 @@
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).
8set -euo pipefail
9
10parse_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.
35handle_arg() {
36 echo "unknown: $1"
37 exit 1
38}