echo "coriolis2" > /opt/chroot/coriolis/etc/debian_chroot
# make coriolis2 profile
mkdir -p /etc/schroot/coriolis2
-cp /etc/schroot/default/* /etc/schroot/coriolis2
+cp /etc/schroot/default/copyfiles /etc/schroot/coriolis2
+
+# just... don't ask. yes, really, schroot fails if this is missing
+mkdir -p /run/systemd/userdb
+
+# create special nssthingy not copying passwd or shadow
+cat <<EOF >/etc/schroot/coriolis2/nssdatabases
+# System databases to copy into the chroot from the host system.
+#
+# <database name>
+gshadow
+services
+protocols
+networks
+hosts
+EOF
# create special fstab not bind-mounting /home
cat <<EOF >/etc/schroot/coriolis2/fstab
# Install apt dependencies in the chroot
cd /tmp
-schroot -c coriolis /bin/bash << EOF
+schroot -c coriolis --directory=/tmp /bin/bash << EOF
echo Installing necessary apt dependencies in the chroot
apt-get update -y
apt-get upgrade -y
apt-get install -y automake binutils-dev bison build-essential \
-sysvinit-utils sysvinit-core \
-ccache clang cmake doxygen dvipng flex gcc git graphviz \
-imagemagick libboost-all-dev libboost-python-dev libbz2-dev \
-libmpfr-dev libgmp-dev libmotif-dev libreadline-dev \
-libqwt-dev libtool libx11-dev libxaw7-dev libxml2-dev \
-python2.7 python2.7-dev \
-libxpm-dev libxt-dev python3.7 python3-jinja2 python3-pip \
-python3-setuptools python-dev python-qt4 python-sphinx \
-qt4-dev-tools rapidjson-dev tcl tcl-dev tcl-tclreadline \
-texlive texlive-fonts-extra texlive-lang-french \
-texlive-latex-extra texlive-pictures xfig yosys zlib1g-dev
+ sysvinit-utils sysvinit-core \
+ ccache clang cmake doxygen dvipng flex gcc git graphviz \
+ imagemagick libboost-all-dev libboost-python-dev libbz2-dev \
+ libmpfr-dev libgmp-dev libmotif-dev libreadline-dev \
+ libqwt-dev libtool libx11-dev libxaw7-dev libxml2-dev \
+ python2.7 python2.7-dev \
+ libxpm-dev libxt-dev python3.7 python3-jinja2 python3-pip \
+ python3-setuptools python-dev python-qt4 python-sphinx \
+ qt4-dev-tools rapidjson-dev tcl tcl-dev tcl-tclreadline \
+ texlive texlive-fonts-extra texlive-lang-french \
+ texlive-latex-extra texlive-pictures xfig zlib1g-dev
# yeah don't add systemd in a chroot. not funny joke
apt-get remove -y systemd
# Build and install yosys from source
# note that a specific version of yosys is needed for ls180 at the moment
-chroot /opt/chroot/coriolis /bin/bash << EOF
+schroot -c coriolis --directory=/tmp /bin/bash << EOF
+echo "deb-src http://ftp.debian.org/debian buster main" > /etc/apt/sources.list.d/bustersrc.list
apt-get update -y
apt-get build-dep yosys -y
-apt-get remove yosys -y
EOF
-runuser $SUDO_USER --preserve-environment -c 'schroot -c coriolis /bin/bash << EOF
+
+runuser $SUDO_USER --preserve-environment -c 'schroot -c coriolis --directory=/tmp /bin/bash << EOF
cd /home/$SUDO_USER
git clone https://github.com/cliffordwolf/yosys.git
cd yosys
make -j$(nproc)
EOF'
-chroot /opt/chroot/coriolis /bin/bash << EOF
+schroot -c coriolis --directory=/tmp /bin/bash << EOF
cd /home/$SUDO_USER/yosys
make install
EOF
# Install coriolis2 from source
-runuser $SUDO_USER --preserve-environment -c 'schroot -c coriolis /bin/bash << EOF
+runuser $SUDO_USER --preserve-environment -c 'schroot -c coriolis --directory=/tmp /bin/bash << EOF
cd /home/$SUDO_USER
source .bash_profile
mkdir -p /home/$SUDO_USER/coriolis-2.x/src
EOF'
# Install alliance from source
-runuser $SUDO_USER --preserve-environment -c 'schroot -c coriolis /bin/bash << EOF
+runuser $SUDO_USER --preserve-environment -c 'schroot -c coriolis --directory=/tmp /bin/bash << EOF
cd /home/$SUDO_USER
source coriolisenv
git clone https://gitlab.lip6.fr/vlsi-eda/alliance.git
../src/configure --prefix=/home/$SUDO_USER/alliance/install --enable-alc-shared
EOF'
-chroot /opt/chroot/coriolis /bin/bash << EOF
+schroot -c coriolis --directory=/tmp /bin/bash << EOF
cd /home/$SUDO_USER/alliance/build
source /home/$SUDO_USER/coriolisenv
make -j1 install
EOF
# Install and configure alliance-check-toolkit
-runuser $SUDO_USER --preserve-environment -c 'schroot -c coriolis /bin/bash << EOF
+runuser $SUDO_USER --preserve-environment -c 'schroot -c coriolis --directory=/tmp /bin/bash << EOF
cd /home/$SUDO_USER
git clone https://gitlab.lip6.fr/vlsi-eda/alliance-check-toolkit.git
source coriolisenv