From: Luke Kenneth Casson Leighton Date: Thu, 19 Aug 2021 21:20:19 +0000 (+0100) Subject: use schroot "type=directory" which means no need to do fstab modification X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=73665de001274ba32defd384dfc31ffde3aca83f;p=dev-env-setup.git use schroot "type=directory" which means no need to do fstab modification --- diff --git a/coriolis2-chroot b/coriolis2-chroot index ecaff42..779cfaa 100755 --- a/coriolis2-chroot +++ b/coriolis2-chroot @@ -3,14 +3,6 @@ if [ "$EUID" -ne 0 ] then echo "Please run as root" exit fi -# Setup fstab mount points -cat <<'EOF' >> /etc/fstab -/dev /opt/chroot/coriolis/dev none bind 0 0 -/dev/pts /opt/chroot/coriolis/dev/pts none bind 0 0 -/proc /opt/chroot/coriolis/proc none bind 0 0 -/sys /opt/chroot/coriolis/sys none bind 0 0 -/tmp /opt/chroot/coriolis/tmp none bind 0 0 -EOF # Create coriolis chroot dir in /opt mkdir -p /opt/chroot/coriolis # Install debootstrap and schroot via apt @@ -18,12 +10,6 @@ apt install -y debootstrap schroot # Install debian/buster chroot using debootstrap /usr/sbin/debootstrap buster /opt/chroot/coriolis \ http://ftp.uk.debian.org/debian -# Mount all chroot mount points from fstab -mount /opt/chroot/coriolis/dev -mount /opt/chroot/coriolis/dev/pts -mount /opt/chroot/coriolis/proc -mount /opt/chroot/coriolis/sys -mount /opt/chroot/coriolis/tmp echo "coriolis2" > /opt/chroot/coriolis/etc/debian_chroot # Install apt dependencies in the chroot chroot /opt/chroot/coriolis /bin/bash << EOF @@ -70,6 +56,7 @@ cat <>/etc/schroot/schroot.conf description=Debian Buster for Coriolis directory=/opt/chroot/coriolis groups=sbuild-security,$SUDO_USER,users +type=directory EOF echo "Adding the following coriolis section to /etc/schroot/schroot.conf: @@ -78,6 +65,7 @@ echo "Adding the following coriolis section to /etc/schroot/schroot.conf: description=Debian Buster for Coriolis directory=/opt/chroot/coriolis groups=sbuild-security,$SUDO_USER,users +type=directory This enables you to chroot into coriolis as an unprivileged user by running 'schroot -c coriolis /bin/bash' diff --git a/mk-deb-chroot b/mk-deb-chroot index 4fae5d9..805f18f 100755 --- a/mk-deb-chroot +++ b/mk-deb-chroot @@ -9,14 +9,6 @@ if [ -z "$1" ] fi chrootdir="$1" echo "creating chroot '$chrootdir'" -# Setup fstab mount points -cat <> /etc/fstab -/dev /opt/chroot/$chrootdir/dev none bind 0 0 -/dev/pts /opt/chroot/$chrootdir/dev/pts none bind 0 0 -/proc /opt/chroot/$chrootdir/proc none bind 0 0 -/sys /opt/chroot/$chrootdir/sys none bind 0 0 -/tmp /opt/chroot/$chrootdir/tmp none bind 0 0 -EOF # Create coriolis chroot dir in /opt mkdir -p /opt/chroot/$chrootdir @@ -25,12 +17,6 @@ apt install -y debootstrap schroot # Install debian/buster chroot using debootstrap /usr/sbin/debootstrap buster /opt/chroot/$chrootdir \ http://ftp.uk.debian.org/debian -# Mount all chroot mount points from fstab -mount /opt/chroot/$chrootdir/dev -mount /opt/chroot/$chrootdir/dev/pts -mount /opt/chroot/$chrootdir/proc -mount /opt/chroot/$chrootdir/sys -mount /opt/chroot/$chrootdir/tmp echo "$chrootdir" > /opt/chroot/$chrootdir/etc/debian_chroot # Install apt dependencies in the chroot @@ -82,6 +68,7 @@ cat <>/etc/schroot/schroot.conf description=Debian Buster for $chrootdir directory=/opt/chroot/$chrootdir groups=sbuild-security,$SUDO_USER,users +type=directory EOF echo "Adding the following $chrootdir section to /etc/schroot/schroot.conf: @@ -90,6 +77,7 @@ echo "Adding the following $chrootdir section to /etc/schroot/schroot.conf: description=Debian Buster for $chrootdir directory=/opt/chroot/$chrootdir groups=sbuild-security,$SUDO_USER,users +type=directory This enables you to chroot into $chrootdir as an unprivileged user by running 'schroot -c $chrootdir /bin/bash'