From bd9237df516c3327c4f84d9c17f658ca5f104b41 Mon Sep 17 00:00:00 2001 From: Mikolaj Wielgus Date: Thu, 19 Aug 2021 23:48:20 +0200 Subject: [PATCH] Exit if the chroot directory already exists --- mk-deb-chroot | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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 -- 2.30.2