fix: suppress verbose command output in installer TUI

All mkfs, cryptsetup, grub-install, tar, update-initramfs output now
goes to log file only via run() wrapper. Console shows only clean TUI
status messages (step/ok/warn/fail/spinner).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Dorian
2026-03-29 12:06:19 +01:00
parent 2e29a41627
commit 39d7bd07b9

View File

@@ -1407,9 +1407,12 @@ cat > "$ARCH_DIR/auto-install.sh" <<'INSTALLER_SCRIPT'
set -e
# Log everything to a file on the target disk (after mount) and to console
# Log file — verbose command output goes here, TUI stays on console
INSTALL_LOG="/tmp/archipelago-install.log"
exec > >(tee -a "$INSTALL_LOG") 2>&1
# Run commands quietly: redirect their stdout/stderr to log
# TUI functions (p, step, ok, etc.) print directly to console
run() { "$@" >> "$INSTALL_LOG" 2>&1; }
runq() { "$@" >>"$INSTALL_LOG" 2>&1 || true; }
# Detect architecture at install time
case "$(uname -m)" in
@@ -1620,8 +1623,8 @@ fi
step "Formatting partitions"
# Zero out the BIOS boot partition to prevent FAT-fs read errors during boot
dd if=/dev/zero of="$BIOS_PART" bs=1M count=1 2>/dev/null || true
mkfs.vfat -F32 -n EFI "$EFI_PART"
mkfs.ext4 -F -L archipelago "$ROOT_PART"
run mkfs.vfat -F32 -n EFI "$EFI_PART"
run mkfs.ext4 -F -L archipelago "$ROOT_PART"
# Mount root + extract rootfs (need cryptsetup from rootfs for LUKS)
ok "Partitions created"
@@ -1633,7 +1636,7 @@ mkdir -p /mnt/target/boot/efi
mount "$EFI_PART" /mnt/target/boot/efi
step "Installing system"
tar -xf "$ROOTFS_TAR" -C /mnt/target
run tar -xf "$ROOTFS_TAR" -C /mnt/target
# LUKS2 encryption for data partition
step "Encrypting data partition"
@@ -1661,24 +1664,24 @@ else
fi
# Format LUKS2 partition with key file
chroot /mnt/target cryptsetup luksFormat --type luks2 \
run chroot /mnt/target cryptsetup luksFormat --type luks2 \
--key-file /root/.luks-archipelago.key \
--cipher "$LUKS_CIPHER" --key-size 512 \
--pbkdf argon2id --batch-mode \
"$DATA_PART"
# Open the LUKS volume
chroot /mnt/target cryptsetup open --type luks2 \
run chroot /mnt/target cryptsetup open --type luks2 \
--key-file /root/.luks-archipelago.key \
"$DATA_PART" archipelago-data
# Unmount chroot bind mounts (will be re-mounted later for grub-install)
umount /mnt/target/sys 2>/dev/null || true
umount /mnt/target/proc 2>/dev/null || true
umount /mnt/target/dev
runq umount /mnt/target/sys
runq umount /mnt/target/proc
runq umount /mnt/target/dev
# Format the inner filesystem
mkfs.ext4 -F -L archipelago-data /dev/mapper/archipelago-data
run mkfs.ext4 -F -L archipelago-data /dev/mapper/archipelago-data
# Mount encrypted partition
mkdir -p /mnt/target/var/lib/archipelago
@@ -2144,14 +2147,14 @@ chroot /mnt/target dpkg --purge shim-signed shim-helpers-amd64-signed shim-helpe
# UEFI boot: install to fallback path (/EFI/BOOT/BOOTX64.EFI) for maximum compatibility
echo " Installing UEFI bootloader..."
if chroot /mnt/target grub-install --target=${GRUB_TARGET} --efi-directory=/boot/efi --bootloader-id=archipelago --removable; then
echo " ✅ UEFI bootloader installed (removable/fallback path)"
if run chroot /mnt/target grub-install --target=${GRUB_TARGET} --efi-directory=/boot/efi --bootloader-id=archipelago --removable; then
ok "UEFI bootloader installed (removable/fallback path)"
else
echo " ⚠️ UEFI removable install failed, trying standard..."
if chroot /mnt/target grub-install --target=${GRUB_TARGET} --efi-directory=/boot/efi --bootloader-id=archipelago; then
echo " ✅ UEFI bootloader installed (standard)"
warn "UEFI removable install failed, trying standard..."
if run chroot /mnt/target grub-install --target=${GRUB_TARGET} --efi-directory=/boot/efi --bootloader-id=archipelago; then
ok "UEFI bootloader installed (standard)"
else
echo " ❌ UEFI bootloader installation failed"
fail "UEFI bootloader installation failed"
fi
fi
@@ -2195,10 +2198,10 @@ fi
# (if /sys/firmware/efi exists, the machine supports UEFI — no need for BIOS fallback)
if [ -n "${GRUB_BIOS_TARGET}" ] && [ ! -d /sys/firmware/efi ]; then
echo " Installing Legacy BIOS bootloader (machine booted in BIOS mode)..."
if chroot /mnt/target grub-install --target=${GRUB_BIOS_TARGET} "${TARGET_DISK}"; then
echo " ✅ Legacy BIOS bootloader installed"
if run chroot /mnt/target grub-install --target=${GRUB_BIOS_TARGET} "${TARGET_DISK}"; then
ok "Legacy BIOS bootloader installed"
else
echo " ⚠️ Legacy BIOS bootloader failed (UEFI-only boot)"
warn "Legacy BIOS bootloader failed (UEFI-only boot)"
fi
elif [ -n "${GRUB_BIOS_TARGET}" ]; then
echo " Skipping Legacy BIOS bootloader (machine supports UEFI)"
@@ -2241,9 +2244,9 @@ fi
# Regenerate initramfs — the one from Docker export is corrupt/incomplete
# (Docker builds have limited /proc, /sys, /dev so initramfs generation fails silently)
echo " Regenerating initramfs..."
chroot /mnt/target update-initramfs -u -k all 2>&1 | grep -v "Possible missing firmware"
run chroot /mnt/target update-initramfs -u -k all
chroot /mnt/target update-grub
run chroot /mnt/target update-grub
# CRITICAL: Write EFI grub.cfg that finds the root filesystem and loads the full config.
# grub-install --removable creates a BOOTX64.EFI that looks for grub.cfg on the