From: Evgeniy Ivanov Date: Mon, 13 Feb 2012 08:08:25 +0000 (+0400) Subject: update_bootcfg script X-Git-Tag: v3.2.0~38 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=c9f65d5ae66d67a36e198e1f629b3e6f6fc9b0d8;p=minix.git update_bootcfg script . script to make neat menu entries for all /boot/minix/* dirs in /boot.cfg, read by new bootloader . invoked when new images are created --- diff --git a/etc/Makefile b/etc/Makefile index adad27129..cf6ae56c3 100644 --- a/etc/Makefile +++ b/etc/Makefile @@ -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 index 000000000..c913dc0a8 --- /dev/null +++ b/etc/boot.cfg.default @@ -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 diff --git a/tools/Makefile b/tools/Makefile index 461a4d67e..1e430aa56 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -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 index 000000000..c73863cb1 --- /dev/null +++ b/tools/update_bootcfg.sh @@ -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