/tmp /tmp none rw,bind 0 0
EOF
-# Add chroot config to schroot.conf
-cat <<EOF >>/etc/schroot/schroot.conf
+if grep -x "\[$chrootdir\]" /etc/schroot/schroot.conf; then
+ echo "Found [$chrootdir] section in /etc/schroot/schroot.conf"
+else
+ # Add chroot config to schroot.conf
+ cat <<EOF >>/etc/schroot/schroot.conf
[$chrootdir]
description=Debian Buster for $chrootdir
directory=/opt/chroot/$chrootdir
profile=$chrootdir
EOF
-echo "Adding the following $chrootdir section to /etc/schroot/schroot.conf:
+ echo "Adding the following $chrootdir section to /etc/schroot/schroot.conf:
[$chrootdir]
description=Debian Buster for $chrootdir
This enables you to chroot into $chrootdir as an unprivileged user by running
'schroot -c $chrootdir /bin/bash'
"
+fi
# Install apt dependencies in the chroot
cd /tmp