fix: heredoc quoting in installer profile.d (boot media not found)
Some checks failed
Build Archipelago ISO (dev) / build-iso (push) Failing after 22m46s

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 <<PROFILE with \$ escaping (matching .228's working version).
Also adds fallback device scanning if standard mount points are empty,
and fixes same quoting issue in grub-embed.cfg ($root variable).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Dorian
2026-03-28 18:44:36 +00:00
parent aada19754d
commit cfe4a03ffb

View File

@@ -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 <<PROFILE
#!/bin/bash
# Auto-start Archipelago installer on login — only run once
if [ -n "$INSTALLER_STARTED" ]; then
if [ -n "\$INSTALLER_STARTED" ]; then
return 0 2>/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 <<GRUBEMBED
insmod part_gpt
insmod fat
insmod iso9660
@@ -650,7 +671,7 @@ insmod normal
insmod linux
insmod all_video
search --no-floppy --set=root --label ARCHIPELAGO
set prefix=($root)/boot/grub
set prefix=(\$root)/boot/grub
normal
GRUBEMBED