Add a nextboot script to make it easier to control the loader nextboot

support. Also, hook it up to the build.

Approved by:	jake (mentor)
This commit is contained in:
Gordon Tetlow 2002-05-24 04:06:03 +00:00
parent 6f7a1f9947
commit a119f25995
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=97203
2 changed files with 59 additions and 0 deletions

View file

@ -14,4 +14,6 @@ MLINKS+= boot_${MACHINE}.8 boot.8
LINKS= ${BINDIR}/reboot ${BINDIR}/halt ${BINDIR}/reboot ${BINDIR}/fastboot \
${BINDIR}/reboot ${BINDIR}/fasthalt
SCRIPTS= nextboot.sh
.include <bsd.prog.mk>

57
sbin/reboot/nextboot.sh Normal file
View file

@ -0,0 +1,57 @@
#! /bin/sh
#
# Copyright 2002. Gordon Tetlow.
# gordon@FreeBSD.org
#
# $FreeBSD$
delete="NO"
force="NO"
nextboot_file="/boot/nextboot.conf"
display_usage() {
echo "Usage: nextboot [-f] [-o options] -k kernel"
echo " nextboot -D"
}
while getopts "Dfk:o:" argument ; do
case "${argument}" in
D)
delete="YES"
;;
f)
force="YES"
;;
k)
kernel="${OPTARG}"
;;
o)
kernel_options="${OPTARG}"
;;
*)
display_usage
exit 1
;;
esac
done
if [ ${delete} = "YES" ]; then
rm -f ${nextboot_file}
exit 0
fi
if [ "xxx${kernel}" = "xxx" ]; then
display_usage
exit 1
fi
if [ ${force} = "NO" -a ! -d /boot/${kernel} ]; then
echo "Error: /boot/${kernel} doesn't exist. Use -f to override."
exit 1
fi
cat > ${nextboot_file} << EOF
nextboot_enable="YES"
kernel="${kernel}"
kernel_options="${kernel_options}"
EOF