From: Mikolaj Wielgus Date: Thu, 19 Aug 2021 21:48:20 +0000 (+0200) Subject: Exit if the chroot directory already exists X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bd9237df516c3327c4f84d9c17f658ca5f104b41;p=dev-env-setup.git Exit if the chroot directory already exists --- diff --git a/mk-deb-chroot b/mk-deb-chroot index 680f024..948bd3f 100755 --- a/mk-deb-chroot +++ b/mk-deb-chroot @@ -4,14 +4,20 @@ if [ "$EUID" -ne 0 ] exit fi if [ -z "$1" ] - then echo "need arg $1 for chroot to make" + then echo "Need arg $1 for chroot to make" exit fi chrootdir="$1" -echo "creating chroot '$chrootdir'" + +if [ -e /opt/chroot/$chrootdir ]; then + echo "/opt/chroot/$chrootdir already exists" + exit +fi + +echo "Creating chroot dir '$chrootdir'" # Create coriolis chroot dir in /opt -mkdir -p /opt/chroot/$chrootdir +mkdir /opt/chroot/$chrootdir # Install debootstrap and schroot if [ -e /etc/debian_version ]; then