From: Andrey Miroshnikov Date: Mon, 13 Sep 2021 15:34:02 +0000 (+0100) Subject: mk-deb-chroot: made schroot profile config into a variable containing the text. Varia... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6faa11535efd76fdcb3d729722d39adf5c26b336;p=dev-env-setup.git mk-deb-chroot: made schroot profile config into a variable containing the text. Variable is used with cat and echo (before echo print was missing the profile=) --- diff --git a/mk-deb-chroot b/mk-deb-chroot index c432d3f..526c26c 100755 --- a/mk-deb-chroot +++ b/mk-deb-chroot @@ -63,35 +63,46 @@ cp /etc/schroot/default/copyfiles /etc/schroot/$chrootdir touch /etc/schroot/$chrootdir/nssdatabases # create special fstab not bind-mounting /home -cat </etc/schroot/$chrootdir/fstab +schroot_fstab=" # /proc /proc none rw,bind 0 0 /sys /sys none rw,bind 0 0 /dev /dev none rw,bind 0 0 /dev/pts /dev/pts none rw,bind 0 0 /tmp /tmp none rw,bind 0 0 +" + +cat </etc/schroot/$chrootdir/fstab +$schroot_fstab EOF -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 +echo "Adding the following fstab mounts to /etc/schroot/$chrootdir/fstab: + +$schroot_fstab + +These rules are for the virtual filesystems used by linux in the chroot env +" + +schroot_profile=" [$chrootdir] description=Debian Buster for $chrootdir directory=/opt/chroot/$chrootdir groups=sbuild-security,$SUDO_USER,users type=directory profile=$chrootdir +" + +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 +$schroot_profile EOF echo "Adding the following $chrootdir section to /etc/schroot/schroot.conf: -[$chrootdir] -description=Debian Buster for $chrootdir -directory=/opt/chroot/$chrootdir -groups=sbuild-security,$SUDO_USER,users -type=directory +$schroot_profile This enables you to chroot into $chrootdir as an unprivileged user by running 'schroot -c $chrootdir /bin/bash'