mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2026-01-04 08:12:06 +01:00
90 lines
2.5 KiB
Bash
Executable File
90 lines
2.5 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
default=0
|
|
timeout=5
|
|
verbose=0
|
|
|
|
# read in extlinux settings
|
|
source /etc/extlinux.conf
|
|
|
|
everbose() {
|
|
if [ "$verbose" = "0" ]; then
|
|
return
|
|
fi
|
|
|
|
echo $*
|
|
}
|
|
|
|
everbose "Updating extlinux configuration."
|
|
|
|
if [ "x$root" = "x" ]; then
|
|
everbose "WARNING: Root device not specified, determining automatically."
|
|
everbose -n "Root device is: "
|
|
export `blkid -o export /dev/root`
|
|
root=UUID=$UUID
|
|
everbose $root
|
|
fi
|
|
|
|
everbose "Installing mboot.c32 to /boot."
|
|
cp /usr/share/syslinux/mboot.c32 /boot
|
|
|
|
everbose "Installing menu.c32 to /boot."
|
|
cp /usr/share/syslinux/menu.c32 /boot
|
|
|
|
rtimeout=$((${timeout}\*10))
|
|
# vesa menu has been requested?
|
|
if [ "$fancy_menu" = "1" ]; then
|
|
everbose "Installing vesamenu.c32 to /boot."
|
|
cp /usr/share/syslinux/vesamenu.c32 /boot
|
|
|
|
echo "DEFAULT vesamenu.c32" > /boot/extlinux.conf.new
|
|
echo "PROMPT 0" >> /boot/extlinux.conf.new
|
|
echo "MENU TITLE Alpine/$(uname -s) Boot Menu" >> /boot/extlinux.conf.new
|
|
if [ "$hidden" = "1" ]; then
|
|
echo "MENU HIDDEN" >> /boot/extlinux.conf.new
|
|
fi
|
|
echo "MENU AUTOBOOT Alpine will be booted automatically in # seconds." >> /boot/extlinux.conf.new
|
|
echo "TIMEOUT $rtimeout" >> /boot/extlinux.conf.new
|
|
else
|
|
echo "DEFAULT menu.c32" > /boot/extlinux.conf.new
|
|
echo "PROMPT 0" >> /boot/extlinux.conf.new
|
|
echo "MENU TITLE Alpine/$(uname -s) Boot Menu" >> /boot/extlinux.conf.new
|
|
if [ "$hidden" = "1" ]; then
|
|
echo "MENU HIDDEN" >> /boot/extlinux.conf.new
|
|
fi
|
|
echo "MENU AUTOBOOT Alpine will be booted automatically in # seconds." >> /boot/extlinux.conf.new
|
|
echo "TIMEOUT $rtimeout" >> /boot/extlinux.conf.new
|
|
fi
|
|
|
|
lst=0
|
|
for kernel in $(find /boot -name vmlinuz-* -type f); do
|
|
tag=$(basename $kernel | cut -b9-)
|
|
everbose "Found kernel: $kernel"
|
|
|
|
if [ -f "/boot/initramfs-$tag" ]; then
|
|
everbose "Found initramfs: /boot/initramfs-$tag"
|
|
initramfs="initrd=initramfs-$tag"
|
|
fi
|
|
|
|
echo "LABEL $lst" >> /boot/extlinux.conf.new
|
|
if [ "$lst" = "$default" ]; then
|
|
echo " MENU DEFAULT" >> /boot/extlinux.conf.new
|
|
fi
|
|
echo " MENU LABEL Linux $tag" >> /boot/extlinux.conf.new
|
|
echo " KERNEL $(basename $kernel)" >> /boot/extlinux.conf.new
|
|
echo " APPEND $initramfs root=$root modules=$modules,$TYPE $default_kernel_opts" >> /boot/extlinux.conf.new
|
|
lst=$(($lst + 1))
|
|
done
|
|
|
|
if [ -f "/boot/memtest" ]; then
|
|
everbose "Found memtest86+: /boot/memtest"
|
|
echo "LABEL $lst" >> /boot/extlinux.conf.new
|
|
echo " MENU LABEL Memtest86+" >> /boot/extlinux.conf.new
|
|
echo " KERNEL memtest" >> /boot/extlinux.conf.new
|
|
lst=$(($lst + 1))
|
|
fi
|
|
|
|
everbose "$lst entries found."
|
|
|
|
mv /boot/extlinux.conf.new /boot/extlinux.conf
|