]> Zhao Yanbai Git Server - minix.git/commitdiff
update_bootcfg script
authorEvgeniy Ivanov <lolkaantimat@gmail.com>
Mon, 13 Feb 2012 08:08:25 +0000 (12:08 +0400)
committerBen Gras <ben@minix3.org>
Tue, 14 Feb 2012 13:52:14 +0000 (14:52 +0100)
. script to make neat menu entries for all /boot/minix/* dirs
  in /boot.cfg, read by new bootloader
. invoked when new images are created

etc/Makefile
etc/boot.cfg.default [new file with mode: 0644]
tools/Makefile
tools/update_bootcfg.sh [new file with mode: 0755]

index adad27129faefd8ddfc0a6f18ed97e637139593c..cf6ae56c3dd42a0eb6f063f9be72f0b0191facd0 100644 (file)
@@ -6,11 +6,11 @@ FILES1=group hostname.file inet.conf motd.install mtab profile \
        protocols rc services termcap ttytab utmp rc.cd  \
        syslog.conf rc.daemons.dist \
        rs.inet rs.single make.conf system.conf ttys resolv.conf rc.conf \
-       rc.subr rc.subr.minix man.conf shells
+       rc.subr rc.subr.minix man.conf shells boot.cfg.default
 
 PWFILES=master.passwd
 FILES3=daily dhcptags.conf rc 
-DEFAULTFILES=rc.conf minix.rc.conf
+DEFAULTFILES=rc.conf minix.rc.conf 
 USRFILES=Makefile
 
 TOOL_PWD_MKDB= pwd_mkdb
diff --git a/etc/boot.cfg.default b/etc/boot.cfg.default
new file mode 100644 (file)
index 0000000..c913dc0
--- /dev/null
@@ -0,0 +1,6 @@
+clear=1
+timeout=5
+default=2
+menu=Start MINIX 3:load_mods /boot/minix_default/mod*;multiboot /boot/minix_default/kernel rootdevname=$rootdevname
+menu=Start latest MINIX 3:load_mods /boot/minix_latest/mod*;multiboot /boot/minix_latest/kernel rootdevname=$rootdevname
+menu=Drop to boot prompt:prompt
index 461a4d67e68c027716a967a1c3edc5bf42ed3b77..1e430aa565ee7fcbfee698f94671432ae31e1ba3 100644 (file)
@@ -95,6 +95,7 @@ hdboot: image
        cp kernel /boot/minix/.temp/
        [ -d /boot/image ] && ln -f /boot/minix/.temp/kernel /boot/kernel || true
        exec sh mkboot $@ minix
+       exec sh update_bootcfg.sh
 
 fdboot:        image
        exec su root mkboot $@
diff --git a/tools/update_bootcfg.sh b/tools/update_bootcfg.sh
new file mode 100755 (executable)
index 0000000..c73863c
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/sh
+set -e
+
+ROOT=`printroot -r`
+DEFAULTCFG=/etc/boot.cfg.default
+LOCALCFG=/etc/boot.cfg.local
+TMP=/boot.cfg.temp
+
+if [ ! -b "$ROOT" ]
+then
+       echo root device $ROOT not found
+       exit 1
+fi
+
+rootdevname=`echo $ROOT | sed 's/\/dev\///'`
+
+if [ -r $DEFAULTCFG ]
+then
+       default_cfg=`cat $DEFAULTCFG`
+       # Substitute variables like $rootdevname
+       echo "$default_cfg" | while read line; do eval echo \"$line\" >> $TMP; done
+fi
+
+latest=`basename \`stat -f "%Y" /boot/minix_latest\``
+
+for i in /boot/minix/*
+do
+       build_name="`basename $i`"
+       if [ "$build_name" != "$latest" ]
+       then
+               echo "menu=Start MINIX 3 ($build_name):load_mods $i/mod*;multiboot $i/kernel rootdevname=$rootdevname" >> /$TMP
+       fi
+done
+
+[ -r $LOCALCFG ] && cat $LOCALCFG >> $TMP
+
+mv $TMP /boot.cfg
+
+sync