aboutsummaryrefslogtreecommitdiffstats
path: root/main/syslinux/update-extlinux
diff options
context:
space:
mode:
authorWilliam Pitcock <nenolod@dereferenced.org>2011-06-11 00:02:11 -0500
committerWilliam Pitcock <nenolod@dereferenced.org>2011-06-11 00:02:11 -0500
commitcddf77d67884c0c62ebbdfb9f0f0d2ae018f1c80 (patch)
tree2b0f06b3e0271805e8dc4188c5aa3737dee4c84e /main/syslinux/update-extlinux
parent04bcbc0e40e51345ae68b3743ce5dcdfa6144da4 (diff)
downloadaports-cddf77d67884c0c62ebbdfb9f0f0d2ae018f1c80.tar.bz2
aports-cddf77d67884c0c62ebbdfb9f0f0d2ae018f1c80.tar.xz
main/syslinux: dynamically generate /boot/extlinux.conf using a trigger on /boot
Diffstat (limited to 'main/syslinux/update-extlinux')
-rwxr-xr-xmain/syslinux/update-extlinux85
1 files changed, 85 insertions, 0 deletions
diff --git a/main/syslinux/update-extlinux b/main/syslinux/update-extlinux
new file mode 100755
index 0000000000..831eaa05bd
--- /dev/null
+++ b/main/syslinux/update-extlinux
@@ -0,0 +1,85 @@
+#!/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
+ echo "MENU HIDDEN" >> /boot/extlinux.conf.new
+ 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
+ echo "MENU HIDDEN" >> /boot/extlinux.conf.new
+ 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 $default_kernel_opts" >> /boot/extlinux.conf.new
+ lst=$(($lst + 1))
+done
+
+if [ -f "/boot/memtest.bin" ]; then
+ everbose "Found memtest86+: /boot/memtest.bin"
+ echo "LABEL $lst" >> /boot/extlinux.conf.new
+ echo " MENU LABEL Memtest86+" >> /boot/extlinux.conf.new
+ echo " KERNEL memtest.bin" >> /boot/extlinux.conf.new
+ lst=$(($lst + 1))
+fi
+
+everbose "$lst entries found."
+
+mv /boot/extlinux.conf.new /boot/extlinux.conf