aboutsummaryrefslogtreecommitdiffstats
path: root/main/syslinux/update-extlinux
diff options
context:
space:
mode:
Diffstat (limited to 'main/syslinux/update-extlinux')
-rwxr-xr-xmain/syslinux/update-extlinux89
1 files changed, 89 insertions, 0 deletions
diff --git a/main/syslinux/update-extlinux b/main/syslinux/update-extlinux
new file mode 100755
index 0000000000..25585334be
--- /dev/null
+++ b/main/syslinux/update-extlinux
@@ -0,0 +1,89 @@
+#!/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