diff options
author | wes <wes@FreeBSD.org> | 2006-01-16 16:18:54 +0000 |
---|---|---|
committer | wes <wes@FreeBSD.org> | 2006-01-16 16:18:54 +0000 |
commit | 078db77066c713846da7ec42595b99f9abe157c5 (patch) | |
tree | 1bf4b98b6b63331a100396fc4e90dd6fd8beb620 /sbin | |
parent | 528140c6f27d2120a3f9b4a3d9ebef15ab5f13a4 (diff) | |
download | FreeBSD-src-078db77066c713846da7ec42595b99f9abe157c5.zip FreeBSD-src-078db77066c713846da7ec42595b99f9abe157c5.tar.gz |
Remove dependency on getopts because it is on /usr and we want to
use 'nextboot -D' in rc. Option parsing cribbed from vgrind.sh.
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/reboot/nextboot.sh | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/sbin/reboot/nextboot.sh b/sbin/reboot/nextboot.sh index 56e53f6..ece2da9 100644 --- a/sbin/reboot/nextboot.sh +++ b/sbin/reboot/nextboot.sh @@ -8,31 +8,46 @@ delete="NO" force="NO" nextboot_file="/boot/nextboot.conf" +kernel="" display_usage() { echo "Usage: nextboot [-f] [-o options] -k kernel" echo " nextboot -D" } -while getopts "Dfk:o:" argument ; do - case "${argument}" in - D) +# Parse args, do not use getopt because we don't want to rely on /usr +while test $# -gt 0; do + case $1 in + -D) delete="YES" ;; - f) + -f) force="YES" ;; - k) - kernel="${OPTARG}" + -k) + if test $# -lt 2; then + echo "$0: option $1 must specify kernel" + display_usage + exit 1 + fi + kernel="$2" + shift ;; - o) - kernel_options="${OPTARG}" + -o) + if test $# -lt 2; then + echo "$0: option $1 must specify boot options" + display_usage + exit 1 + fi + kernel_options="$2" + shift ;; *) display_usage exit 1 ;; esac + shift done if [ ${delete} = "YES" ]; then |