aboutsummaryrefslogtreecommitdiffstats
path: root/main/syslinux
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
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')
-rw-r--r--main/syslinux/APKBUILD15
-rw-r--r--main/syslinux/extlinux.conf22
-rw-r--r--main/syslinux/syslinux.trigger3
-rwxr-xr-xmain/syslinux/update-extlinux85
4 files changed, 122 insertions, 3 deletions
diff --git a/main/syslinux/APKBUILD b/main/syslinux/APKBUILD
index abaf424c84..df9cef11ad 100644
--- a/main/syslinux/APKBUILD
+++ b/main/syslinux/APKBUILD
@@ -1,14 +1,17 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=syslinux
pkgver=4.04
-pkgrel=0
+pkgrel=1
pkgdesc="a boot loader for the Linux operating system which operates off an MS-DOS/Windows FAT filesystem."
url="http://syslinux.org"
arch="x86 x86_64"
license="GPL"
makedepends="nasm perl"
-depends="mtools"
+depends="mtools blkid"
+triggers="syslinux.trigger:/boot"
source="http://www.kernel.org/pub/linux/utils/boot/syslinux/${pkgver%%.*}.xx/$pkgname-$pkgver.tar.bz2
+ extlinux.conf
+ update-extlinux
"
subpackages="$pkgname-doc"
@@ -26,6 +29,12 @@ build() {
package() {
cd "$_builddir"
make INSTALLROOT="$pkgdir" MANDIR=/usr/share/man local-install
+
+ mkdir -p "$pkgdir"/etc
+ cp "$srcdir"/extlinux.conf "$pkgdir"/etc/
+ cp "$srcdir"/update-extlinux "$pkgdir"/sbin/
}
-md5sums="a3936208767eb7ced65320abe2e33a10 syslinux-4.04.tar.bz2"
+md5sums="a3936208767eb7ced65320abe2e33a10 syslinux-4.04.tar.bz2
+b7506dbbe9f05bed6d9e78f222b1e0ce extlinux.conf
+2c1016e63c12d4e8ca49aab374f2389e update-extlinux"
diff --git a/main/syslinux/extlinux.conf b/main/syslinux/extlinux.conf
new file mode 100644
index 0000000000..5894b4ab3c
--- /dev/null
+++ b/main/syslinux/extlinux.conf
@@ -0,0 +1,22 @@
+# configuration for extlinux config builder
+
+# fancy_menu
+# use fancy vesa menu (vesamenu.c32) menus, won't work with serial
+fancy_menu=0
+
+# default_kernel_opts
+# default kernel options
+default_kernel_opts=quiet
+
+# modules
+# modules which should be loaded before pivot_root
+modules=sd-mod,usb-storage,ext3
+
+# root
+# root device - if not specified, will be guessed using
+# blkid -o export /dev/root
+root=
+
+# verbose
+# if set to non-zero, update-extlinux will be a lot more verbose.
+verbose=0
diff --git a/main/syslinux/syslinux.trigger b/main/syslinux/syslinux.trigger
new file mode 100644
index 0000000000..1e463cddae
--- /dev/null
+++ b/main/syslinux/syslinux.trigger
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+update-extlinux
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