aboutsummaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorGordon Tetlow <gordon@FreeBSD.org>2002-05-24 04:06:03 +0000
committerGordon Tetlow <gordon@FreeBSD.org>2002-05-24 04:06:03 +0000
commita119f259955f142a20d551d91b53716aecd57edb (patch)
tree1f58376e4ca882e2e9a0038b7e0683509283dcf7 /sbin
parent6f7a1f99473dc94032dbfec2d4f6b50c645fb238 (diff)
downloadsrc-a119f259955f142a20d551d91b53716aecd57edb.tar.gz
src-a119f259955f142a20d551d91b53716aecd57edb.zip
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)
Notes
Notes: svn path=/head/; revision=97203
Diffstat (limited to 'sbin')
-rw-r--r--sbin/reboot/Makefile2
-rw-r--r--sbin/reboot/nextboot.sh57
2 files changed, 59 insertions, 0 deletions
diff --git a/sbin/reboot/Makefile b/sbin/reboot/Makefile
index 2a0e4ac573ee..c70a3f2550e7 100644
--- a/sbin/reboot/Makefile
+++ b/sbin/reboot/Makefile
@@ -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>
diff --git a/sbin/reboot/nextboot.sh b/sbin/reboot/nextboot.sh
new file mode 100644
index 000000000000..56e53f60a1a9
--- /dev/null
+++ b/sbin/reboot/nextboot.sh
@@ -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