From nobody Wed Oct 18 07:48:47 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4S9NJb4gf9z4xgpT; Wed, 18 Oct 2023 07:48:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S9NJb3wsTz3WMy; Wed, 18 Oct 2023 07:48:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697615327; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fonGzp0e0UWpfSLJpaYqYscupjTyPzkdsctoIdpRrJw=; b=mZvRO/qwdBqBMW3MpC4ahpo7frX/QL/da2grWEV74GaeQOxxFIP07gB4TukELkC8/nTLQN gJ/swHL5lc2uB90mTMTBGoSoYYGp58zuEJNTaZ+KJydLyHrLquAXzY3ODripdAVne8flu3 FnOFb3I1yatmpnr4x10CTbiBbw2ihpu0mP1+utx9n6S4GJFpEJAjgBpsDd0HpHyal23T08 cyNE2dHvuWnsORUbhyQkHx9vmw6XKe66dkyBkmjixEYpWVwunwg8lhzzbGE7GVqGtxkZic Up+2VxqwQo4CZFItuay3dQQT9cCnsO3lYoIkXWMJhKu43yN45q8GuHyHasCvQg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697615327; a=rsa-sha256; cv=none; b=AtSa9WRNEr4SnaTeqiWfTOW+/+NRCr1Dsnx2fWoWRLjg8BwbZYCWxtUjA50OBXhl4RVzb0 WDW1Pz3iEP7StGiYle7/UYrabT05xMpD937i7e2rIf5f5jXRiJNPVpPcZUYqTy4kGaCazk jJOMttBk+qX34mdLcc3/Gz0JSmD/IjzBRIcaiR9AHpS8X612Q2DronjVwJkCsM0XAZ0EMX 90iMTkvYLqFB2W37pp8fVA4kvkvyXo6js9/jihm+g6l62rLhRFuEtT+wrNcL6edp75SNKe 9dimoOytT+3SX7urjvhRisAULsHgGDn6KVyrBesF7Bvla0wqPoGx7q+KlOk1bQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697615327; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fonGzp0e0UWpfSLJpaYqYscupjTyPzkdsctoIdpRrJw=; b=pPon52ThU1Dwm4WmY0DPxsxaY72AZ64y/CspZVK47ZzqQtg+zebMhko0y7DJSjGf5/Wkq7 R+Qz+rW/mkXwJ/Xsri5vO0e3/kAE5bH6w6wr6mm0cnk/8Bl0mDsvktcM5m560pu76A196x xGKDkiA/G7OTl+Qp40+9K+h0fXtxXLHaOc1A6U1yDimtD7t7MDBEaY2YgqODxMoNUAi+yI rGDwHSpfcrRYBum6tuoPea+p/j1Mi333FjL5zUwd7fBXGxBnpN7663u4cVKhSvfulTwBMU Hu5ARKHBiUxz5bdiKPoLNM2QOs9fE+XW2sNyKC/WUK3Xx6A878wwiggu0a6ArQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4S9NJb2zDMzyWW; Wed, 18 Oct 2023 07:48:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 39I7mli7009927; Wed, 18 Oct 2023 07:48:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39I7mliI009924; Wed, 18 Oct 2023 07:48:47 GMT (envelope-from git) Date: Wed, 18 Oct 2023 07:48:47 GMT Message-Id: <202310180748.39I7mliI009924@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Fernando =?utf-8?Q?Apestegu=C3=ADa?= Subject: git: b9cf989234d3 - main - bsdinstall: Fail nicely in jail target List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fernape X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b9cf989234d37a0885ee6228bcb6fa8f20f72b2f Auto-Submitted: auto-generated The branch main has been updated by fernape: URL: https://cgit.FreeBSD.org/src/commit/?id=b9cf989234d37a0885ee6228bcb6fa8f20f72b2f commit b9cf989234d37a0885ee6228bcb6fa8f20f72b2f Author: Fernando ApesteguĂ­a AuthorDate: 2023-10-17 13:37:04 +0000 Commit: Fernando ApesteguĂ­a 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"