From 717733522bec23baa8aeb00f8cf0cd4f284566c5 Mon Sep 17 00:00:00 2001 From: Dorian Date: Sat, 28 Mar 2026 18:44:36 +0000 Subject: [PATCH] fix: heredoc quoting in installer profile.d (boot media not found) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The profile.d script used <<'PROFILE' (single-quoted heredoc) inside a bash -c '...' single-quoted block. The inner quotes broke the outer quoting, causing all $ variables to expand to empty at build time. The for loop checked if [ -f "/archipelago/auto-install.sh" ] instead of if [ -f "$dev/archipelago/auto-install.sh" ] — never matching. Fix: use < --- image-recipe/build-auto-installer-iso.sh | 39 ++++++++++++++++++------ 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/image-recipe/build-auto-installer-iso.sh b/image-recipe/build-auto-installer-iso.sh index 75f1736c..7ea62e48 100755 --- a/image-recipe/build-auto-installer-iso.sh +++ b/image-recipe/build-auto-installer-iso.sh @@ -527,10 +527,10 @@ GETTY # Auto-start installer via profile.d (runs after auto-login, no getty race) # This is the same approach the working Debian Live build used. mkdir -p /installer/etc/profile.d -cat > /installer/etc/profile.d/z99-archipelago-installer.sh <<'PROFILE' +cat > /installer/etc/profile.d/z99-archipelago-installer.sh </dev/null || exit 0 fi export INSTALLER_STARTED=1 @@ -545,21 +545,42 @@ echo "" BOOT_MEDIA="" for dev in /run/live/medium /lib/live/mount/medium /run/archiso /cdrom /media/cdrom /mnt/iso; do - if [ -f "$dev/archipelago/auto-install.sh" ]; then - BOOT_MEDIA="$dev" + if [ -f "\$dev/archipelago/auto-install.sh" ]; then + BOOT_MEDIA="\$dev" break fi done -if [ -n "$BOOT_MEDIA" ]; then - echo -e " \033[37mFound installer at: $BOOT_MEDIA\033[0m" +# If standard mount points failed, actively find and mount the boot device +if [ -z "\$BOOT_MEDIA" ]; then + echo -e " \033[37mSearching for boot device...\033[0m" + mkdir -p /run/archiso 2>/dev/null + for blk in /dev/sr0 /dev/sd[a-z] /dev/sd[a-z][0-9] /dev/nvme[0-9]n[0-9]p[0-9]; do + [ -b "\$blk" ] || continue + mount -o ro "\$blk" /run/archiso 2>/dev/null || continue + if [ -f /run/archiso/archipelago/auto-install.sh ]; then + BOOT_MEDIA="/run/archiso" + break + fi + umount /run/archiso 2>/dev/null + done +fi + +if [ -n "\$BOOT_MEDIA" ]; then + echo -e " \033[37mFound installer at: \$BOOT_MEDIA\033[0m" echo "" echo -e " Press Enter to install | \033[1;37mCtrl+C\033[0m for shell" read -s - bash "$BOOT_MEDIA/archipelago/auto-install.sh" + bash "\$BOOT_MEDIA/archipelago/auto-install.sh" else echo -e " \033[37mInstaller not found on boot media.\033[0m" echo "" + echo -e " \033[37mDebug info:\033[0m" + ls -la /run/live/ 2>/dev/null || echo " /run/live/ does not exist" + mount | grep -E "iso9660|squashfs|overlay" 2>/dev/null + echo "" + echo -e " \033[37mTry: mount /dev/sdX /mnt/iso && bash /mnt/iso/archipelago/auto-install.sh\033[0m" + echo "" fi PROFILE chmod +x /installer/etc/profile.d/z99-archipelago-installer.sh @@ -641,7 +662,7 @@ mksquashfs /installer /output/filesystem.squashfs -comp xz -Xbcj x86 -noappend - # Build GRUB EFI image with embedded bootstrap config (grub-mkstandalone) echo " [container] Building GRUB EFI image..." -cat > /tmp/grub-embed.cfg <<'GRUBEMBED' +cat > /tmp/grub-embed.cfg <