Skip to content

Commit b26d87c

Browse files
authored
Merge pull request #195 from nova-rey/codex/fix25-prompt-20251225-2011-20
Codex: fix25.prompt.md
2 parents c650e4c + b98bf82 commit b26d87c

41 files changed

Lines changed: 125 additions & 12 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

build/installer-initramfs/init

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ sp_log() {
5353
printf '[SP-INSTALLER] %s\n' "$@" >>"$SP_LOG_DEVICE" 2>&1
5454
}
5555

56+
sp_log_warn() {
57+
sp_log "$@"
58+
}
59+
5660
sp_trim() {
5761
printf '%s' "$1" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'
5862
}
@@ -574,6 +578,9 @@ sp_load_filesystem_modules() {
574578

575579
sp_bootstrap() {
576580
PATH=/bin:/sbin:/usr/bin:/usr/sbin
581+
if [ -n "${SP_PREPEND_PATH:-}" ]; then
582+
PATH="${SP_PREPEND_PATH}:${PATH}"
583+
fi
577584
export PATH
578585

579586
# BusyBox setup (best-effort).

build/installer-initramfs/runtime/lib/rescue_mode.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ sp_rescue_log_line() {
2121
printf '[SP-RESCUE] %s\n' "$*" >>"$SP_RESCUE_LOG_DEVICE" 2>/dev/null || true
2222
}
2323

24+
sp_rescue_log_noninteractive_skip() {
25+
printf '[SP-INSTALLER][WARN] rescue noninteractive; skipping shell\n' >&2
26+
}
27+
2428
sp_rescue_write_header() {
2529
sp_rescue_log_line "state=rescue" "result=enter" "reason=${1:-unknown}"
2630
sp_rescue_log_line "==== SP RESCUE MODE ===="
@@ -211,7 +215,21 @@ sp_enter_rescue_mode() {
211215
console_path="${SP_TEST_RESCUE_CONSOLE:-${SP_RESCUE_CONSOLE:-/dev/console}}"
212216
shell_path="$(sp_rescue_find_shell || true)"
213217

218+
rescue_noninteractive=0
219+
if [ "${SP_RESCUE_FORCE_INTERACTIVE:-0}" != "1" ]; then
220+
if [ ! -t 0 ]; then
221+
rescue_noninteractive=1
222+
fi
223+
if [ "${SP_RESCUE_NONINTERACTIVE:-0}" = "1" ]; then
224+
rescue_noninteractive=1
225+
fi
226+
fi
227+
214228
if [ -n "${shell_path:-}" ]; then
229+
if [ "${rescue_noninteractive:-0}" -eq 1 ]; then
230+
sp_rescue_log_noninteractive_skip
231+
return 1
232+
fi
215233
rescue_loop="${SP_TEST_RESCUE_LOOP:-1}"
216234
sp_rescue_log_line "state=rescue" "note=launching-shell" "shell=${shell_path}" "console=${console_path}"
217235
first_loop=1

build/installer-initramfs/runtime/lib/storage_bootstrap.sh

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,26 @@ sp_bootstrap_usb_storage() {
9292
for host in /sys/class/scsi_host/host*; do
9393
[ -d "$host" ] || continue
9494
scan="${host}/scan"
95-
printf '%s\n' "- - -" > "$scan" 2>/dev/null || true
95+
[ -e "$scan" ] || continue
96+
if [ ! -w "$scan" ]; then
97+
sp_log_warn \
98+
"state=storage-bootstrap" \
99+
"phase=scsi-scan" \
100+
"result=warn" \
101+
"reason=scan-not-writable" \
102+
"scan=${scan}"
103+
continue
104+
fi
105+
106+
if ! printf '%s\n' "- - -" > "$scan" 2>/dev/null; then
107+
sp_log_warn \
108+
"state=storage-bootstrap" \
109+
"phase=scsi-scan" \
110+
"result=warn" \
111+
"reason=scan-write-failed" \
112+
"scan=${scan}"
113+
continue
114+
fi
96115
done
97116

98117
sp_bootstrap_usb_storage_run_test_trigger

dist/initrd-installer.img

385 Bytes
Binary file not shown.
Lines changed: 9 additions & 0 deletions
-49 Bytes
Binary file not shown.

installer/init/init.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ sp_log() {
5353
printf '[SP-INSTALLER] %s\n' "$@" >>"$SP_LOG_DEVICE" 2>&1
5454
}
5555

56+
sp_log_warn() {
57+
sp_log "$@"
58+
}
59+
5660
sp_trim() {
5761
printf '%s' "$1" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'
5862
}
@@ -574,6 +578,9 @@ sp_load_filesystem_modules() {
574578

575579
sp_bootstrap() {
576580
PATH=/bin:/sbin:/usr/bin:/usr/sbin
581+
if [ -n "${SP_PREPEND_PATH:-}" ]; then
582+
PATH="${SP_PREPEND_PATH}:${PATH}"
583+
fi
577584
export PATH
578585

579586
# BusyBox setup (best-effort).
-49 Bytes
Binary file not shown.
-49 Bytes
Binary file not shown.

installer/runtime/lib/storage_bootstrap.sh

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,26 @@ sp_bootstrap_usb_storage() {
9292
for host in /sys/class/scsi_host/host*; do
9393
[ -d "$host" ] || continue
9494
scan="${host}/scan"
95-
printf '%s\n' "- - -" > "$scan" 2>/dev/null || true
95+
[ -e "$scan" ] || continue
96+
if [ ! -w "$scan" ]; then
97+
sp_log_warn \
98+
"state=storage-bootstrap" \
99+
"phase=scsi-scan" \
100+
"result=warn" \
101+
"reason=scan-not-writable" \
102+
"scan=${scan}"
103+
continue
104+
fi
105+
106+
if ! printf '%s\n' "- - -" > "$scan" 2>/dev/null; then
107+
sp_log_warn \
108+
"state=storage-bootstrap" \
109+
"phase=scsi-scan" \
110+
"result=warn" \
111+
"reason=scan-write-failed" \
112+
"scan=${scan}"
113+
continue
114+
fi
96115
done
97116

98117
sp_bootstrap_usb_storage_run_test_trigger

0 commit comments

Comments
 (0)