From 51bc9c3ad8838c86db53ed21b95c3b8c154ff22b Mon Sep 17 00:00:00 2001 From: Mikolaj Wielgus Date: Fri, 20 Aug 2021 23:31:30 +0200 Subject: [PATCH] Do not create duplicate sections in schroot.conf --- mk-deb-chroot | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mk-deb-chroot b/mk-deb-chroot index 948bd3f..969930f 100755 --- a/mk-deb-chroot +++ b/mk-deb-chroot @@ -48,8 +48,11 @@ cat </etc/schroot/$chrootdir/fstab /tmp /tmp none rw,bind 0 0 EOF -# Add chroot config to schroot.conf -cat <>/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 <>/etc/schroot/schroot.conf [$chrootdir] description=Debian Buster for $chrootdir directory=/opt/chroot/$chrootdir @@ -58,7 +61,7 @@ type=directory 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 @@ -69,6 +72,7 @@ type=directory 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 -- 2.30.2