[Lunar-commits] <moonbase> Subject: syslinux: Add bootloader plugin for sys/extlinux
Auke Kok
sofar at foo-projects.org
Sun Sep 5 23:55:42 CEST 2010
commit d662fac5203cc3888f80622994989021648151ef
Author: Auke Kok <sofar at foo-projects.org>
Date: Sun Sep 5 23:55:42 2010 +0200
Subject: syslinux: Add bootloader plugin for sys/extlinux
---
utils/syslinux/plugin.d/bootloader-syslinux.plugin | 70 ++++++++++++++++++++
1 files changed, 70 insertions(+), 0 deletions(-)
diff --git a/utils/syslinux/plugin.d/bootloader-syslinux.plugin b/utils/syslinux/plugin.d/bootloader-syslinux.plugin
new file mode 100644
index 0000000..0204104
--- /dev/null
+++ b/utils/syslinux/plugin.d/bootloader-syslinux.plugin
@@ -0,0 +1,70 @@
+#!/bin/bash
+#############################################################
+# #
+# bootloader-syslinux.plugin - plugin that performs #
+# extlinux maintenance #
+# #
+#############################################################
+# #
+# Copyright 2010 by Auke Kok under GPLv2 #
+# #
+#############################################################
+
+
+plugin_kernel_updatebootloader_syslinux() {
+ # preferred? - master switch for experienced users
+ if [ -n "$BOOTLOADER" -a "$BOOTLOADER" != "syslinux" ]; then
+ return 2
+ fi
+ if [ ! -d /boot/extlinux ]; then
+ return 2
+ fi
+ debug_msg "plugin_kernel_updatebootloader_extlinux ($@)"
+
+ local BOOTPART BOOTDIR ROOTPART TMP DONE
+
+ entry() {
+ echo "label $2"
+ echo " menu label $2"
+ echo " kernel $3/$1"
+ echo " append root=$4 ro quiet"
+ echo ""
+ }
+
+ cp /boot/extlinux/extlinux.conf /boot/extlinux/extlinux.conf.new || return 1
+
+ # determine if BOOT is a separate partition:
+ BOOTPART=$(grep "^/dev/" /etc/mtab | awk '($2 == "/boot"){print $1}')
+ if [ -n "$BOOTPART" ]; then
+ BOOTDIR=""
+ else
+ BOOTDIR="/boot"
+ fi
+ # determine what to tell our kernel is the rootfs partition
+ ROOTPART=$(grep "^/dev/" /etc/mtab | awk '($2 == "/"){print $1}')
+
+ TMP=$(temp_create)
+ while read LINE ; do
+ if [ -z "$DONE" ]; then
+ if echo "$LINE" | grep -q "^\s*label" ; then
+ # insert
+ entry "$1" "$2" "$BOOTDIR" "$ROOTPART" >> $TMP
+ DONE="x"
+ fi
+ fi
+ echo "$LINE" >> $TMP
+ done < /boot/extlinux/extlinux.conf
+ cp $TMP /boot/extlinux/extlinux.conf
+ temp_destroy $TMP
+
+ if query "Edit syslinux configuration manually ?" n ; then
+ edit_file /boot/extlinux/extlinux.conf
+ fi
+
+ # right now we want to have it run all bootloaders?
+ return 2
+}
+
+
+plugin_register KERNEL_UPDATEBOOTLOADER plugin_kernel_updatebootloader_syslinux
+
More information about the Lunar-commits
mailing list