From: Andrey Miroshnikov Date: Thu, 23 Sep 2021 21:17:22 +0000 (+0100) Subject: coriolis_install: Now using USER var instead of SUDO_USER. Made .bash_profile edit... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1322ca1193437f86dcb9437c814f7b6b64d5c607;p=dev-env-setup.git coriolis_install: Now using USER var instead of SUDO_USER. Made .bash_profile edit into a var for both writing and echoing. Still debugging coriolisEnv.py --- diff --git a/coriolis_install b/coriolis_install index 5769bf9..850068c 100755 --- a/coriolis_install +++ b/coriolis_install @@ -1,11 +1,12 @@ #!/bin/bash -# name of user running script -if [ -z $SUDO_USER ] - echo "Checking whoami for current user" - then SUDO_USER=$(whoami) +if [ "$EUID" -eq 0 ]; then + echo "Please run as a normal user!" + echo "This script is NOT intended to run as root." + exit fi -echo "Current SUDO_USER=$SUDO_USER" + +echo "Current USER=$USER" # Install apt dependencies echo Installing necessary apt dependencies in the chroot @@ -25,12 +26,20 @@ sudo apt-get install -y automake binutils-dev bison build-essential \ 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 +vars_for_bash_profile="export PATH=/usr/lib/ccache:\044PATH +export DISPLAY=:0.0 +export ALLIANCE_TOP=/home/$USER/alliance/install +export YOSYS_TOP=/home/$USER/yosys +export LD_LIBRARY_PATH=\044{ALLIANCE_TOP}/lib:\044{LD_LIBRARY_PATH} +export LD_LIBRARY_PATH=\044{ALLIANCE_TOP}/lib64:\044{LD_LIBRARY_PATH}" + +echo -e "$vars_for_bash_profile" > /home/$USER/.bash_profile -sudo chown $SUDO_USER /home/$SUDO_USER/.bash_profile -sudo chgrp $SUDO_USER /home/$SUDO_USER/.bash_profile +echo "Setting /home/$USER/.bash_profile file to (for faster rebuilds): +$vars_for_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" +sudo chown $USER /home/$USER/.bash_profile +sudo chgrp $USER /home/$USER/.bash_profile # Build and install yosys from source # note that a specific version of yosys is needed for ls180 at the moment @@ -38,7 +47,7 @@ echo "deb-src http://ftp.debian.org/debian buster main" > /etc/apt/sources.list. sudo apt-get update -y sudo apt-get build-dep yosys -y -cd /home/$SUDO_USER +cd /home/$USER git clone https://github.com/cliffordwolf/yosys.git cd yosys git checkout 049e3abf9baf795e69b9ecb9c4f19de6131f8418 @@ -46,14 +55,14 @@ make config-clang # WAY too heavy a load (18+) - make -j$(nproc) make -cd /home/$SUDO_USER/yosys +cd /home/$USER/yosys sudo make install # Install coriolis2 from source -cd /home/$SUDO_USER +cd /home/$USER source .bash_profile -mkdir -p /home/$SUDO_USER/coriolis-2.x/src -cd /home/$SUDO_USER/coriolis-2.x/src +mkdir -p /home/$USER/coriolis-2.x/src +cd /home/$USER/coriolis-2.x/src git clone https://gitlab.lip6.fr/vlsi-eda/coriolis.git cd coriolis git checkout devel @@ -61,38 +70,38 @@ git checkout devel ./bootstrap/ccb.py --project=coriolis --make="-j1 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 +/home/$USER/coriolis-2.x/src/coriolis/bootstrap/coriolisEnv.py > /home/$USER/coriolisenv +source /home/$USER/.bash_profile +source /home/$USER/coriolisenv # Install alliance from source -cd /home/$SUDO_USER +cd /home/$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 +mkdir -p /home/$USER/alliance/build /home/$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/$USER/alliance/build +../src/configure --prefix=/home/$USER/alliance/install --enable-alc-shared -cd /home/$SUDO_USER/alliance/build -source /home/$SUDO_USER/coriolisenv +cd /home/$USER/alliance/build +source /home/$USER/coriolisenv sudo make -j1 install # Install and configure alliance-check-toolkit -cd /home/$SUDO_USER +cd /home/$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 <>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 +touch alliance-check-toolkit/etc/mk/users.d/user-$USER.mk +cat <>alliance-check-toolkit/etc/mk/users.d/user-$USER.mk +export CORIOLIS_TOP=/home/$USER/coriolis-2.x/Linux.x86_64/Release.Shared/install +export ALLIANCE_TOP=/home/$USER/alliance/install +export CHECK_TOOLKIT=/home/$USER/alliance-check-toolkit +export YOSYS_TOP=/home/$USER/yosys EOG -source /home/$SUDO_USER/.bash_profile +source /home/$USER/.bash_profile cd alliance-check-toolkit/benchs/ARM/cmos make lvx echo -e " @@ -100,6 +109,6 @@ echo -e " " make cgt -cd /home/$SUDO_USER/ -sudo chown -R $SUDO_USER * -sudo chgrp -R $SUDO_USER * +cd /home/$USER/ +sudo chown -R $USER * +sudo chgrp -R $USER *