update_bootcfg improvements.

- Fix a glitch (don't glob '*' in for).
- update_bootcfg should be a /bin command.
- update_bootcfg should not add menu entries for missing kernels.
This commit is contained in:
Evgeniy Ivanov
2012-02-16 17:38:38 +04:00
committed by Ben Gras
parent 24f1e18846
commit 72eca0eb1e
5 changed files with 70 additions and 41 deletions

View File

@@ -98,7 +98,7 @@ hdboot: image
strip -s /boot/minix/.temp/kernel
[ -d /boot/image ] && ln -f /boot/minix/.temp/kernel /boot/kernel || true
sh mkboot $@ minix
exec sh update_bootcfg.sh
sh ../commands/update_bootcfg/update_bootcfg.sh
fdboot: image
exec su root mkboot $@

View File

@@ -1,39 +0,0 @@
#!/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