diff options
author | Paul Onyschuk <blink@bojary.koba.pl> | 2011-08-03 21:57:04 +0200 |
---|---|---|
committer | Paul Onyschuk <blink@bojary.koba.pl> | 2011-08-03 21:57:04 +0200 |
commit | 29bbbeb3db30522980c2864f55822826b848c805 (patch) | |
tree | ade861469b58369dc8fff086044138055577f9de | |
parent | 0fcc07ab8d7c2944559714ca5d450b6cf4bbd68d (diff) | |
parent | b0740647731bf96a401540e02ce54753da77057f (diff) | |
download | aports-29bbbeb3db30522980c2864f55822826b848c805.tar.bz2 aports-29bbbeb3db30522980c2864f55822826b848c805.tar.xz |
Merge remote-tracking branch 'upstream/master'
-rw-r--r-- | main/syslinux/APKBUILD | 17 | ||||
-rw-r--r-- | main/syslinux/syslinux.post-upgrade | 61 | ||||
-rwxr-xr-x | main/syslinux/update-extlinux | 118 | ||||
-rw-r--r-- | main/syslinux/update-extlinux.conf (renamed from main/syslinux/extlinux.conf) | 9 |
4 files changed, 159 insertions, 46 deletions
diff --git a/main/syslinux/APKBUILD b/main/syslinux/APKBUILD index 5a962cfddd..6687475c53 100644 --- a/main/syslinux/APKBUILD +++ b/main/syslinux/APKBUILD @@ -1,16 +1,17 @@ # Maintainer: Natanael Copa <ncopa@alpinelinux.org> pkgname=syslinux pkgver=4.04 -pkgrel=4 -pkgdesc="a boot loader for the Linux operating system which operates off an MS-DOS/Windows FAT filesystem." +pkgrel=5 +pkgdesc="Boot loader for the Linux operating system" url="http://syslinux.org" arch="x86 x86_64" license="GPL" makedepends="nasm perl" depends="mtools blkid" -triggers="" +triggers="syslinux.trigger=/boot" +install="syslinux.post-upgrade" source="http://www.kernel.org/pub/linux/utils/boot/syslinux/${pkgver%%.*}.xx/$pkgname-$pkgver.tar.bz2 - extlinux.conf + update-extlinux.conf update-extlinux " subpackages="$pkgname-doc" @@ -30,11 +31,11 @@ package() { cd "$_builddir" make INSTALLROOT="$pkgdir" MANDIR=/usr/share/man local-install - mkdir -p "$pkgdir"/etc - cp "$srcdir"/extlinux.conf "$pkgdir"/etc/ + mkdir -p "$pkgdir"/etc/update-extlinux.d + cp "$srcdir"/update-extlinux.conf "$pkgdir"/etc/ cp "$srcdir"/update-extlinux "$pkgdir"/sbin/ } md5sums="a3936208767eb7ced65320abe2e33a10 syslinux-4.04.tar.bz2 -37f8ae1cbb41b68241d6027abd828318 extlinux.conf -0d769b8a7c01137535bbd26f130a0658 update-extlinux" +14443fe391bd315a54478851abdc32cb update-extlinux.conf +7164c110dae13a8d06d175943e48b841 update-extlinux" diff --git a/main/syslinux/syslinux.post-upgrade b/main/syslinux/syslinux.post-upgrade new file mode 100644 index 0000000000..90388668de --- /dev/null +++ b/main/syslinux/syslinux.post-upgrade @@ -0,0 +1,61 @@ +#!/bin/sh + +# find given append opt +get_append_opt() { + awk -v search="$1" ' + $1 == "append" || $1 == "APPEND" { + split($0, a); + for (i in a) { + if (index(a[i], search) == 1) { + print a[i]; + } + } + }' /boot/extlinux.conf | sort | uniq +} + +# print default kernel options +get_default_opts() { + awk ' + $1 == "append" || $1 == "APPEND" { + opts=""; + space=""; + split($0, a); + for (i in a) { + if (i != 1 \ + && (index(a[i], "root=") != 1) \ + && (index(a[i], "initrd=") != 1) \ + && (index(a[i], "modules=") != 1)) { + opts = opts space a[i]; + space = " "; + } + } + print opts; + } + ' /boot/extlinux.conf | sort | uniq +} + +if ! [ -f /boot/extlinux.conf ]; then + exit 0 +fi + +# check if we already have a generated extlinux.conf +if grep -q '^# Generated by update-extlinux' /boot/extlinux.conf; then + exit 0 +fi + +# try fish out the kernel opts from extlinuix.conf's append line +root=$(get_append_opt 'root=' | head -n 1) +modules=$(get_append_opt 'modules=' | head -n 1) +opts=$(get_default_opts | head -n 1) + +# populate update-extlinux.conf with the info we know +if [ -n "$root" ]; then + sed -i -e "/^root=/s|.*|$root|g" /etc/update-extlinux.conf +fi +if [ -n "$modules" ]; then + sed -i -e "/^modules=/s|.*|$modules|g" /etc/update-extlinux.conf +fi +if [ -n "$opts" ]; then + sed -i -e "/^default_kernel_opts=/s|.*|default_kernel_opts=\"$opts\"|g" /etc/update-extlinux.conf +fi + diff --git a/main/syslinux/update-extlinux b/main/syslinux/update-extlinux index 25585334be..a2488cc8df 100755 --- a/main/syslinux/update-extlinux +++ b/main/syslinux/update-extlinux @@ -4,8 +4,13 @@ default=0 timeout=5 verbose=0 +conf=/boot/extlinux.conf +myconf=/etc/update-extlinux.conf + # read in extlinux settings -source /etc/extlinux.conf +if [ -f "$myconf" ]; then + . $myconf +fi everbose() { if [ "$verbose" = "0" ]; then @@ -15,14 +20,44 @@ everbose() { echo $* } +ewarn() { + echo "WARNING:" $@ >&2 +} + +eerror() { + echo "ERROR:" $@ >&2 + return 1 +} + 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 + ewarn "Root device is not specified in $myconf." + blkid_export=$(blkid -o export /dev/root) + if [ -n "$blkid_export" ]; then + export $blkid_export + fi + if [ -z "$UUID" ]; then + # try parse /proc/mount for mounted / + dev=$(awk '$2 == "/" {dev=$1} END {print dev}' /proc/mounts) + if [ -n "$dev" ]; then + blkid_export=$(blkid -o export $dev) + if [ -n "$blkid_export" ]; then + export "$blkid_export" + fi + fi + fi + if [ -z "$UUID" ]; then + if [ -z "$dev" ]; then + eerror "Failed to detect root device" + exit 1 + else + root=$dev + fi + else + root=UUID=$UUID + fi + everbose "Root device is: $root" fi everbose "Installing mboot.c32 to /boot." @@ -32,29 +67,26 @@ everbose "Installing menu.c32 to /boot." cp /usr/share/syslinux/menu.c32 /boot rtimeout=$((${timeout}\*10)) +syslinux_menu=menu.c32 +menu_hidden= + # 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 +if [ "$vesa_menu" = "1" ]; then + syslinux_menu=vesamenu.c32 +fi + +everbose "Installing $syslinux_menu to /boot." +cp /usr/share/syslinux/vesamenu.c32 /boot + +echo "# Generated by update-extlinux" > $conf.new +echo "DEFAULT $syslinux_menu" >> $conf.new +echo "PROMPT 0" >> $conf.new +echo "MENU TITLE Alpine/$(uname -s) Boot Menu" >> $conf.new +if [ "$hidden" = "1" ]; then + echo "MENU HIDDEN" >> $conf.new fi +echo "MENU AUTOBOOT Alpine will be booted automatically in # seconds." >> $conf.new +echo "TIMEOUT $rtimeout" >> $conf.new lst=0 for kernel in $(find /boot -name vmlinuz-* -type f); do @@ -66,24 +98,38 @@ for kernel in $(find /boot -name vmlinuz-* -type f); do initramfs="initrd=initramfs-$tag" fi - echo "LABEL $lst" >> /boot/extlinux.conf.new + echo "LABEL $lst" >> $conf.new if [ "$lst" = "$default" ]; then - echo " MENU DEFAULT" >> /boot/extlinux.conf.new + echo " MENU DEFAULT" >> $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 + echo " MENU LABEL Linux $tag" >> $conf.new + echo " KERNEL $(basename $kernel)" >> $conf.new + echo " APPEND $initramfs root=$root modules=${modules}${TYPE:+,$TYPE} $default_kernel_opts" >> $conf.new + echo "" >> $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 + echo "LABEL $lst" >> $conf.new + echo " MENU LABEL Memtest86+" >> $conf.new + echo " KERNEL memtest" >> $conf.new + echo "" >> $conf.new lst=$(($lst + 1)) fi everbose "$lst entries found." -mv /boot/extlinux.conf.new /boot/extlinux.conf +for entry in /etc/update-extlinux.d/*; do + [ -f "$entry" ] && cat $entry >> $conf.new +done + +if [ "$overwrite" = "1" ]; then + # keep a backup just in case + if [ -f "$conf" ]; then + mv $conf $conf.old + fi + + mv $conf.new $conf +fi + diff --git a/main/syslinux/extlinux.conf b/main/syslinux/update-extlinux.conf index 05bdcc935b..17a47f22ca 100644 --- a/main/syslinux/extlinux.conf +++ b/main/syslinux/update-extlinux.conf @@ -1,8 +1,13 @@ # configuration for extlinux config builder -# fancy_menu +# overwrite +# Overwrite current /boot/extlinux.conf. If this is not '1' we will only +# write to /boot/extlinux.conf.new +overwrite=1 + +# vesa_menu # use fancy vesa menu (vesamenu.c32) menus, won't work with serial -fancy_menu=0 +vesa_menu=0 # default_kernel_opts # default kernel options |