mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +00:00
feat: add GRUB installer USB boot detection via configfile
Install a /etc/grub.d/07_startos_installer script that searches for a .startos-installer marker file at boot. When found, it creates a "StartOS Installer" menu entry that loads the USB's own grub.cfg via configfile, making it the default with a 5-second timeout. Uses configfile instead of chainloader because on hybrid ISOs the .startos-installer marker and /boot/grub/grub.cfg are on the ISO9660 root partition, while the EFI binary lives on a separate embedded ESP. chainloader would look for the EFI binary on the wrong partition.
This commit is contained in:
40
debian/startos/postinst
vendored
40
debian/startos/postinst
vendored
@@ -54,18 +54,36 @@ if [ -f /etc/default/grub ]; then
|
|||||||
cp /usr/share/grub/unicode.pf2 /boot/grub/fonts/unicode.pf2
|
cp /usr/share/grub/unicode.pf2 /boot/grub/fonts/unicode.pf2
|
||||||
fi
|
fi
|
||||||
# Install conditional serial console script for GRUB
|
# Install conditional serial console script for GRUB
|
||||||
cat > /etc/grub.d/01_serial << 'GRUBEOF'
|
cat > /etc/grub.d/01_serial <<-'GRUBEOF'
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
cat << 'EOF'
|
cat << 'EOF'
|
||||||
# Conditionally enable serial console (avoids breaking gfxterm on EFI
|
# Conditionally enable serial console (avoids breaking gfxterm on EFI
|
||||||
# systems where the serial port is unavailable)
|
# systems where the serial port is unavailable)
|
||||||
if serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1; then
|
if serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1; then
|
||||||
terminal_input console serial
|
terminal_input console serial
|
||||||
terminal_output gfxterm serial
|
terminal_output gfxterm serial
|
||||||
fi
|
fi
|
||||||
EOF
|
EOF
|
||||||
GRUBEOF
|
GRUBEOF
|
||||||
chmod +x /etc/grub.d/01_serial
|
chmod +x /etc/grub.d/01_serial
|
||||||
|
# Install GRUB script to boot from StartOS installer USB when present.
|
||||||
|
# At boot, GRUB searches for the .startos-installer marker and,
|
||||||
|
# if found, loads the USB's own grub.cfg as the default boot entry.
|
||||||
|
cat > /etc/grub.d/07_startos_installer <<-'GRUBEOF'
|
||||||
|
#!/bin/sh
|
||||||
|
cat << 'EOF'
|
||||||
|
search --no-floppy --file --set=installer_dev /.startos-installer
|
||||||
|
if [ -n "$installer_dev" ]; then
|
||||||
|
menuentry "StartOS Installer" --id startos-installer {
|
||||||
|
set root=$installer_dev
|
||||||
|
configfile /boot/grub/grub.cfg
|
||||||
|
}
|
||||||
|
set default=startos-installer
|
||||||
|
set timeout=5
|
||||||
|
fi
|
||||||
|
EOF
|
||||||
|
GRUBEOF
|
||||||
|
chmod +x /etc/grub.d/07_startos_installer
|
||||||
fi
|
fi
|
||||||
|
|
||||||
VERSION="$(cat /usr/lib/startos/VERSION.txt)"
|
VERSION="$(cat /usr/lib/startos/VERSION.txt)"
|
||||||
|
|||||||
Reference in New Issue
Block a user