--- /dev/null
+# name of user running script
+if [ -z $SUDO_USER ]
+ echo "Checking whoami for current user"
+ then SUDO_USER=$(whoami)
+fi
+echo "Current SUDO_USER=$SUDO_USER"
+
+# Install apt dependencies
+echo Installing necessary apt dependencies in the chroot
+sudo apt-get update -y
+sudo apt-get upgrade -y
+sudo 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 zlib1g-dev
+
+# Add convenience variable to chroot user .bash_profile
+echo -e 'export PATH=/usr/lib/ccache:"\044PATH"\nexport DISPLAY=:0.0\nexport ALLIANCE_TOP=/home/$SUDO_USER/alliance/install\nexport YOSYS_TOP=/home/$SUDO_USER/yosys\nexport LD_LIBRARY_PATH=\044{ALLIANCE_TOP}/lib:\044{LD_LIBRARY_PATH}\nexport LD_LIBRARY_PATH=\044{ALLIANCE_TOP}/lib64:\044{LD_LIBRARY_PATH}' > /home/$SUDO_USER/.bash_profile
+
+chown $SUDO_USER /home/$SUDO_USER/.bash_profile
+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"
+
+# Build and install yosys from source
+# note that a specific version of yosys is needed for ls180 at the moment
+echo "deb-src http://ftp.debian.org/debian buster main" > /etc/apt/sources.list.d/bustersrc.list
+sudo apt-get update -y
+sudo apt-get build-dep yosys -y
+
+cd /home/$SUDO_USER
+git clone https://github.com/cliffordwolf/yosys.git
+cd yosys
+git checkout 049e3abf9baf795e69b9ecb9c4f19de6131f8418
+make config-clang
+make -j$(nproc)
+
+cd /home/$SUDO_USER/yosys
+sudo make install
+
+# Install coriolis2 from source
+cd /home/$SUDO_USER
+source .bash_profile
+mkdir -p /home/$SUDO_USER/coriolis-2.x/src
+cd /home/$SUDO_USER/coriolis-2.x/src
+git clone https://gitlab.lip6.fr/vlsi-eda/coriolis.git
+cd coriolis
+git checkout devel
+./bootstrap/ccb.py --project=coriolis --make="-j$(nproc) install"
+
+# Setup and test coriolisenv
+/home/$SUDO_USER/coriolis-2.x/src/coriolis/bootstrap/coriolisEnv.py > /home/$SUDO_USER/coriolisenv
+source /home/$SUDO_USER/.bash_profile
+source /home/$SUDO_USER/coriolisenv
+
+# Install alliance from source
+cd /home/$SUDO_USER
+source coriolisenv
+git clone https://gitlab.lip6.fr/vlsi-eda/alliance.git
+mkdir -p /home/$SUDO_USER/alliance/build /home/$SUDO_USER/alliance/install
+mv alliance/alliance/src alliance
+rm -rf alliance/alliance
+cd alliance/src
+./autostuff
+cd /home/$SUDO_USER/alliance/build
+../src/configure --prefix=/home/$SUDO_USER/alliance/install --enable-alc-shared
+
+cd /home/$SUDO_USER/alliance/build
+source /home/$SUDO_USER/coriolisenv
+sudo make -j1 install
+
+# Install and configure alliance-check-toolkit
+cd /home/$SUDO_USER
+git clone https://gitlab.lip6.fr/vlsi-eda/alliance-check-toolkit.git
+source coriolisenv
+touch alliance-check-toolkit/etc/mk/users.d/user-$SUDO_USER.mk
+cat <<EOG >>alliance-check-toolkit/etc/mk/users.d/user-$SUDO_USER.mk
+export CORIOLIS_TOP=/home/$SUDO_USER/coriolis-2.x/Linux.x86_64/Release.Shared/install
+export ALLIANCE_TOP=/home/$SUDO_USER/alliance/install
+export CHECK_TOOLKIT=/home/$SUDO_USER/alliance-check-toolkit
+export YOSYS_TOP=/home/$SUDO_USER/yosys
+EOG
+source /home/$SUDO_USER/.bash_profile
+cd alliance-check-toolkit/benchs/ARM/cmos
+make lvx
+echo -e "
+\e[1;91mSelect File -> Open Cell or press CTRL + o then enter as the cell name 'arm_chip_cts_r' without the single quotation marks.\e[0m
+"
+make cgt
+
+cd /home/$SUDO_USER/src/nextpnr
+chown -R $SUDO_USER .
+chgrp -R $SUDO_USER .