mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 12:11:56 +00:00
fix: make GRUB serial console conditional on hardware availability
Unconditionally enabling serial terminal broke gfxterm on EFI systems without a serial port. Now installs a /etc/grub.d/01_serial script that probes for the serial port before enabling it. Also copies unicode.pf2 font to boot partition for GRUB graphical mode.
This commit is contained in:
29
debian/startos/postinst
vendored
29
debian/startos/postinst
vendored
@@ -28,13 +28,12 @@ if [ -f /etc/default/grub ]; then
|
|||||||
sed -i '/\(^\|#\)'"$1"'=/d' /etc/default/grub
|
sed -i '/\(^\|#\)'"$1"'=/d' /etc/default/grub
|
||||||
printf '%s="%s"\n' "$1" "$2" >> /etc/default/grub
|
printf '%s="%s"\n' "$1" "$2" >> /etc/default/grub
|
||||||
}
|
}
|
||||||
# Enable both graphical and serial terminal output
|
# Graphical terminal (serial added conditionally via /etc/grub.d/01_serial)
|
||||||
grub_set GRUB_TERMINAL_INPUT 'console serial'
|
grub_set GRUB_TERMINAL_INPUT 'console'
|
||||||
grub_set GRUB_TERMINAL_OUTPUT 'gfxterm serial'
|
grub_set GRUB_TERMINAL_OUTPUT 'gfxterm'
|
||||||
# Remove GRUB_TERMINAL if present (replaced by INPUT/OUTPUT above)
|
# Remove GRUB_TERMINAL and GRUB_SERIAL_COMMAND if present
|
||||||
sed -i '/^\(#\|\)GRUB_TERMINAL=/d' /etc/default/grub
|
sed -i '/^\(#\|\)GRUB_TERMINAL=/d' /etc/default/grub
|
||||||
# Serial console settings
|
sed -i '/^\(#\|\)GRUB_SERIAL_COMMAND=/d' /etc/default/grub
|
||||||
grub_set GRUB_SERIAL_COMMAND 'serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1'
|
|
||||||
# Graphics mode and splash background
|
# Graphics mode and splash background
|
||||||
grub_set GRUB_GFXMODE 800x600
|
grub_set GRUB_GFXMODE 800x600
|
||||||
grub_set GRUB_GFXPAYLOAD_LINUX keep
|
grub_set GRUB_GFXPAYLOAD_LINUX keep
|
||||||
@@ -49,6 +48,24 @@ if [ -f /etc/default/grub ]; then
|
|||||||
mkdir -p /boot/grub/startos-theme
|
mkdir -p /boot/grub/startos-theme
|
||||||
cp -r /usr/lib/startos/grub-theme/* /boot/grub/startos-theme/
|
cp -r /usr/lib/startos/grub-theme/* /boot/grub/startos-theme/
|
||||||
fi
|
fi
|
||||||
|
# Copy font to boot partition so GRUB can load it without accessing rootfs
|
||||||
|
if [ -f /usr/share/grub/unicode.pf2 ]; then
|
||||||
|
mkdir -p /boot/grub/fonts
|
||||||
|
cp /usr/share/grub/unicode.pf2 /boot/grub/fonts/unicode.pf2
|
||||||
|
fi
|
||||||
|
# Install conditional serial console script for GRUB
|
||||||
|
cat > /etc/grub.d/01_serial << 'GRUBEOF'
|
||||||
|
#!/bin/sh
|
||||||
|
cat << 'EOF'
|
||||||
|
# Conditionally enable serial console (avoids breaking gfxterm on EFI
|
||||||
|
# systems where the serial port is unavailable)
|
||||||
|
if serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1; then
|
||||||
|
terminal_input console serial
|
||||||
|
terminal_output gfxterm serial
|
||||||
|
fi
|
||||||
|
EOF
|
||||||
|
GRUBEOF
|
||||||
|
chmod +x /etc/grub.d/01_serial
|
||||||
fi
|
fi
|
||||||
|
|
||||||
VERSION="$(cat /usr/lib/startos/VERSION.txt)"
|
VERSION="$(cat /usr/lib/startos/VERSION.txt)"
|
||||||
|
|||||||
Reference in New Issue
Block a user