From c0498b6935d6001d803dc1d500411fe6f10b9f3a Mon Sep 17 00:00:00 2001 From: Denis Stoecklmeier Date: Thu, 15 Oct 2026 09:52:14 +0200 Subject: [PATCH] USB-Ausfall beim Schreiben klar erkennen --- scripts/install-usb.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/install-usb.sh b/scripts/install-usb.sh index d70cd07..f3ee020 100755 --- a/scripts/install-usb.sh +++ b/scripts/install-usb.sh @@ -60,7 +60,15 @@ trap cleanup EXIT mkdir -p "$TMP/boot" "$TMP/data" mount "$p2" "$TMP/boot"; mount "$p3" "$TMP/data" mkdir -p "$TMP/boot/boot/grub" "$TMP/data/reports" "$TMP/data/database" "$TMP/data/checklists" "$TMP/data/reference" -cp "$ISO" "$TMP/boot/pc-intake.iso" +if ! cp "$ISO" "$TMP/boot/pc-intake.iso" || ! sync -f "$TMP/boot"; then + current_size=$(blockdev --getsize64 "$DEVICE" 2>/dev/null || echo 0) + if ((current_size == 0)); then + echo 'USB medium disappeared while writing. Replace the stick or use another USB port.' >&2 + else + echo 'USB write failed. Check the stick and the kernel log before retrying.' >&2 + fi + exit 1 +fi # Copy video reference files separately under INTAKE_DATA/reference (optional). cat > "$TMP/boot/boot/grub/grub.cfg" <<'GRUBCFG' set timeout=5