bsdinstall: Fail nicely in jail target

If the directory is empty we fail with a message regarding mkdir in which
the empty directory can't be seen because it is not quoted.

Show a nice message so the user knows what is going on.

Reviewed by:		bapt@
Differential Revision:	https://reviews.freebsd.org/D42252
This commit is contained in:
Fernando Apesteguía 2023-10-17 15:37:04 +02:00
parent ef1dad6d83
commit b9cf989234

View file

@ -36,7 +36,6 @@ BSDCFG_SHARE="/usr/share/bsdconfig"
: ${BSDDIALOG_OK=0}
f_dprintf "Began Installation at %s" "$( date )"
export BSDINSTALL_CHROOT=$1
error() {
local msg
@ -54,6 +53,11 @@ error() {
fi
}
if [ -z "$1" ]; then
error "Directory can not be empty\n\nUsage:\nbsdinstall jail directory"
fi
export BSDINSTALL_CHROOT=$1
rm -rf $BSDINSTALL_TMPETC
mkdir $BSDINSTALL_TMPETC
mkdir -p $1 || error "mkdir failed for $1"