The branch main has been updated by fernape: URL: https://cgit.FreeBSD.org/src/commit/?id=b9cf989234d37a0885ee6228bcb6fa8f20f72b2f
commit b9cf989234d37a0885ee6228bcb6fa8f20f72b2f Author: Fernando Apesteguía <fern...@freebsd.org> AuthorDate: 2023-10-17 13:37:04 +0000 Commit: Fernando Apesteguía <fern...@freebsd.org> CommitDate: 2023-10-18 07:46:05 +0000 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 --- usr.sbin/bsdinstall/scripts/jail | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/usr.sbin/bsdinstall/scripts/jail b/usr.sbin/bsdinstall/scripts/jail index feb9d8b1c097..de6dee04b891 100755 --- a/usr.sbin/bsdinstall/scripts/jail +++ b/usr.sbin/bsdinstall/scripts/jail @@ -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"