From 8775c1ad7b93349eaa8de5142ed3f22f3e6657ae Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Wed, 8 Sep 2021 18:48:48 +0100 Subject: [PATCH] sort out coriolis-chroot --- coriolis2-chroot | 58 ++++++++++++++++++++++++++++++------------------ 1 file changed, 37 insertions(+), 21 deletions(-) diff --git a/coriolis2-chroot b/coriolis2-chroot index a19ef53..bb8b7ff 100755 --- a/coriolis2-chroot +++ b/coriolis2-chroot @@ -13,7 +13,22 @@ apt install -y debootstrap schroot 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 </etc/schroot/coriolis2/nssdatabases +# System databases to copy into the chroot from the host system. +# +# +gshadow +services +protocols +networks +hosts +EOF # create special fstab not bind-mounting /home cat </etc/schroot/coriolis2/fstab @@ -50,22 +65,22 @@ 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 +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 @@ -90,12 +105,13 @@ EOF # 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 @@ -104,13 +120,13 @@ make config-clang 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 @@ -127,7 +143,7 @@ source /home/$SUDO_USER/coriolisenv 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 @@ -140,14 +156,14 @@ cd /home/$SUDO_USER/alliance/build ../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 -- 2.30.2