set up profile for schroot, do not copy over nssdatabases
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 19 Aug 2021 22:27:01 +0000 (23:27 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 19 Aug 2021 22:27:01 +0000 (23:27 +0100)
cd to /tmp to prevent schroot error
g

coriolis2-chroot
mk-deb-chroot

index 066c94a2e3c0df63be1663c437419b2135e388cb..a19ef53f29965383026dd843247038f9ef5fd2c7 100755 (executable)
@@ -49,6 +49,7 @@ This enables you to chroot into coriolis as an unprivileged user by running
 "
 
 # Install apt dependencies in the chroot
+cd /tmp
 schroot -c coriolis /bin/bash << EOF
 echo Installing necessary apt dependencies in the chroot
 apt-get update -y
index d97f96c73a880b393b9d98048877d117693e9031..7325377ce8a67ddb9874b8bff093613e33955182 100755 (executable)
@@ -19,6 +19,21 @@ apt install -y debootstrap schroot
                       http://ftp.uk.debian.org/debian
 echo "$chrootdir" > /opt/chroot/$chrootdir/etc/debian_chroot
 
+# make chroot profile
+mkdir -p /etc/schroot/$chrootdir
+cp /etc/schroot/default/copyfiles /etc/schroot/$chrootdir
+touch /etc/schroot/$chrootdir/nssdatabases
+
+# create special fstab not bind-mounting /home
+cat <<EOF >/etc/schroot/$chrootdir/fstab
+# <file system> <mount point>   <type>  <options>       <dump>  <pass>
+/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
+EOF
+
 # Add chroot config to schroot.conf
 cat <<EOF >>/etc/schroot/schroot.conf
 [$chrootdir]
@@ -26,6 +41,7 @@ description=Debian Buster for $chrootdir
 directory=/opt/chroot/$chrootdir
 groups=sbuild-security,$SUDO_USER,users
 type=directory
+profile=$chrootdir
 EOF
 
 echo "Adding the following $chrootdir section to /etc/schroot/schroot.conf:
@@ -41,6 +57,7 @@ This enables you to chroot into $chrootdir as an unprivileged user by running
 "
 
 # Install apt dependencies in the chroot
+cd /tmp
 schroot -c $chrootdir /bin/bash << EOF
 echo Installing necessary apt dependencies in the chroot
 apt-get update -y
@@ -82,4 +99,3 @@ chgrp $SUDO_USER /home/$SUDO_USER/.bash_profile
 
 echo -e "Added 'export PATH=/usr/lib/ccache:\"\044PATH\"\nexport DISPLAY=:0.0' to /home/$SUDO_USER/.bash_profile to speed up rebuilds"
 EOF
-