echo "Creating chroot dir '$chrootdir'"
# Create coriolis chroot dir in /opt
-mkdir /opt/chroot/$chrootdir
+mkdir -p /opt/chroot/$chrootdir
# argh apt with broken proxies and unreliable ISPs, getting fed up with it
if [ -e /tmp/brokenproxy ]; then
cp /tmp/brokenproxy /etc/apt/apt.conf.d/80-retries
fi
-# No need to check if exists, this script always runs with new chroot
-cp /tmp/brokenproxy /opt/chroot/$chrootdir/etc/apt/apt.conf.d/80-retries
-
-
# Install debootstrap and schroot
if [ -e /etc/debian_version ]; then
# Debian detected: use apt
pacman -S --needed debootstrap schroot
fi
-# Install debian/buster chroot using debootstrap
+# Install debian/buster chroot using debootstrap,
+# any /etc/ config must be done after this point!
/usr/sbin/debootstrap buster /opt/chroot/$chrootdir \
http://ftp.uk.debian.org/debian
echo "$chrootdir" > /opt/chroot/$chrootdir/etc/debian_chroot
cp /etc/schroot/default/copyfiles /etc/schroot/$chrootdir
touch /etc/schroot/$chrootdir/nssdatabases
+# Copy over brokenproxy apt script to the new chroot environment
+cp /tmp/brokenproxy /opt/chroot/$chrootdir/etc/apt/apt.conf.d/80-retries
+
# create special fstab not bind-mounting /home
schroot_fstab="
# <file system> <mount point> <type> <options> <dump> <pass>
# Install apt dependencies in the chroot
cd /tmp
-schroot -c $chrootdir /bin/bash << EOF
+schroot -c $chrootdir /bin/bash --directory=/tmp << EOF
echo Installing necessary apt dependencies in the chroot
apt-get update -y
apt-get upgrade -y
apt-get install -y automake binutils-dev build-essential \
-ccache cmake gcc git \
-libtool \
-sysvinit-core \
-sysvinit-utils \
-sudo \
-python2.7 \
-python3 python3-pip \
-python3-setuptools python3-dev
+ ccache cmake gcc git \
+ libtool \
+ sysvinit-core \
+ sysvinit-utils \
+ sudo \
+ python2.7 \
+ python3 python3-pip \
+ python3-setuptools python3-dev
# yeah systemd in a chroot? not very funny joke.
apt-get remove -y systemd