From fe807d84011696d7048a150de786f5a429a55914 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Thu, 19 Aug 2021 23:27:01 +0100 Subject: [PATCH] set up profile for schroot, do not copy over nssdatabases cd to /tmp to prevent schroot error g --- coriolis2-chroot | 1 + mk-deb-chroot | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/coriolis2-chroot b/coriolis2-chroot index 066c94a..a19ef53 100755 --- a/coriolis2-chroot +++ b/coriolis2-chroot @@ -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 diff --git a/mk-deb-chroot b/mk-deb-chroot index d97f96c..7325377 100755 --- a/mk-deb-chroot +++ b/mk-deb-chroot @@ -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 </etc/schroot/$chrootdir/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 +EOF + # Add chroot config to schroot.conf cat <>/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 - -- 2.30.2