From 3b338ae7b621bc4c0ae93ed7d7441820e4536ced Mon Sep 17 00:00:00 2001 From: grant Date: Fri, 30 Jan 2004 08:51:29 +0000 Subject: [PATCH] print a useful error if the pkgsrc directory or src directory doesn't exist. --- mk/bulk/mksandbox | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/mk/bulk/mksandbox b/mk/bulk/mksandbox index cce0168b1474..cd55019048a1 100755 --- a/mk/bulk/mksandbox +++ b/mk/bulk/mksandbox @@ -1,6 +1,6 @@ #! /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. @@ -53,6 +53,12 @@ usage() exit 1 } +err() +{ + echo "error: $1" + exit 1 +} + opsys=`uname -s` case "$opsys" in Darwin) @@ -141,8 +147,15 @@ if [ $# -ne 1 ]; then fi if [ `$idprog -u` -ne 0 ]; then - echo "You must be root to run this script" - exit 1 + err "You must be root to run this script." +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 sandbox=$1