mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-12-28 05:55:27 +01:00
a119f25995
support. Also, hook it up to the build. Approved by: jake (mentor)
58 lines
834 B
Bash
58 lines
834 B
Bash
#! /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
|