print a useful error if the pkgsrc directory or src directory

doesn't exist.
This commit is contained in:
grant 2004-01-30 08:51:29 +00:00
parent fb2aa67691
commit 3b338ae7b6

View file

@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# $NetBSD: mksandbox,v 1.29 2004/01/30 08:34:28 grant Exp $ # $NetBSD: mksandbox,v 1.30 2004/01/30 08:51:29 grant Exp $
# #
# #
# Copyright (c) 2002 Alistair G. Crooks. All rights reserved. # Copyright (c) 2002 Alistair G. Crooks. All rights reserved.
@ -53,6 +53,12 @@ usage()
exit 1 exit 1
} }
err()
{
echo "error: $1"
exit 1
}
opsys=`uname -s` opsys=`uname -s`
case "$opsys" in case "$opsys" in
Darwin) Darwin)
@ -141,8 +147,15 @@ if [ $# -ne 1 ]; then
fi fi
if [ `$idprog -u` -ne 0 ]; then if [ `$idprog -u` -ne 0 ]; then
echo "You must be root to run this script" err "You must be root to run this script."
exit 1 fi
if [ ! -d $pkgsrc ]; then
err "pkgsrc directory $pkgsrc does not exist."
fi
if [ ! -d $src ]; then
err "source directory $src does not exist."
fi fi
sandbox=$1 sandbox=$1