aboutsummaryrefslogtreecommitdiffstats
path: root/main/syslinux/syslinux.post-upgrade
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2011-08-03 16:49:48 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2011-08-03 19:28:23 +0000
commitb0740647731bf96a401540e02ce54753da77057f (patch)
treeba378968f65997bdf0141fee861edf9006e8f206 /main/syslinux/syslinux.post-upgrade
parentc504465e61a866c92c41e38ccc888d58abc73d09 (diff)
downloadaports-b0740647731bf96a401540e02ce54753da77057f.tar.bz2
aports-b0740647731bf96a401540e02ce54753da77057f.tar.xz
main/syslinux: misc update-extlinux fixes
- rename /etc/extlinux-conf to /etc/update-extlinux.conf - Do not exit with fail if update-extlinux.conf is missing - Always warn if root= is not defined in update-extlinux.conf - Try harder to detect the root device by parsing /proc/mounts - Exit with error if we cannot detect the Root device - Rename fancy_menu to vesa_menu - Unifiy the code generating vesa/standard menus - Keep a backup of old extlinux.conf - add "overwrite" config option so it is possible to skip overwriting the extlinux.conf. - Added a post-upgrade that imports current extlinux.conf to update-extlinux.conf
Diffstat (limited to 'main/syslinux/syslinux.post-upgrade')
-rw-r--r--main/syslinux/syslinux.post-upgrade61
1 files changed, 61 insertions, 0 deletions
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
+