Add -f option. If used it will perform the low level block operations on the

file rather than requiring a raw device. Useful when dealing with vnd's
images and building snapshots. Also allows snapshots to be built in
securelevel > 0.
This commit is contained in:
jmc 2001-02-19 06:23:55 +00:00
parent 5bc3f3ff96
commit 106522ed47
1 changed files with 13 additions and 7 deletions

View File

@ -1,5 +1,5 @@
#!/bin/sh
# $NetBSD: binstall.sh,v 1.7 2000/08/20 14:56:28 mrg Exp $
# $NetBSD: binstall.sh,v 1.8 2001/02/19 06:23:55 jmc Exp $
#
vecho () {
@ -27,6 +27,7 @@ Help () {
echo " -u - install sparc64 (UltraSPARC) boot block"
echo " -U - install sparc boot block"
echo " -b<bootprog> - second-stage boot program to install"
echo " -f<path name> - path to device/file image for filesystem"
echo " -m<path> - Look for boot programs in <path> (default: /usr/mdec)"
echo " -v - verbose mode"
echo " -t - test mode (implies -v)"
@ -34,7 +35,8 @@ Help () {
}
Secure () {
echo "This script has to be run when the kernel is in 'insecure' mode."
echo "This script has to be run when the kernel is in 'insecure' mode,"
echo "or when applying bootblocks to a file image (ala vnd)."
echo "The best way is to run this script in single-user mode."
exit 1
}
@ -49,11 +51,7 @@ else
ULTRASPARC=0
fi
if [ "`sysctl -n kern.securelevel`" -gt 0 ]; then
Secure
fi
set -- `getopt "b:hm:tvuU" "$@"`
set -- `getopt "b:hm:f:tvuU" "$@"`
if [ $? -gt 0 ]; then
Usage
fi
@ -65,6 +63,7 @@ do
-u) ULTRASPARC=1; shift ;;
-U) ULTRASPARC=0; shift ;;
-b) BOOTPROG=$2; OFWBOOT=$2; shift 2 ;;
-f) FILENAME=$2; shift 2 ;;
-m) MDEC=$2; shift 2 ;;
-t) TEST=1; VERBOSE=1; shift ;;
-v) VERBOSE=1; shift ;;
@ -72,6 +71,10 @@ do
esac
done
if [ "`sysctl -n kern.securelevel`" -gt 0 ] && [ ! -f "$FILENAME" ]; then
Secure
fi
DOIT=${TEST:+echo "=>"}
if [ $# != 2 ]; then
@ -116,6 +119,9 @@ case $WHAT in
break;
fi
done`
if [ "$FILENAME" != "" ]; then
DEV=$FILENAME
fi
if [ "$DEV" = "" ]; then
echo "Cannot find \"$DEST\" in mount table"
exit 1