From: Andrey Miroshnikov Date: Tue, 26 Jul 2022 00:53:45 +0000 (+0100) Subject: tasyagle-install: workaround to reload .bashrc works, can now compile docs in one go X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bae2009ffc5a3aa630990943abc825585f6927ae;p=dev-env-setup.git tasyagle-install: workaround to reload .bashrc works, can now compile docs in one go --- diff --git a/tasyagle-install b/tasyagle-install index 97a5f63..defb93c 100755 --- a/tasyagle-install +++ b/tasyagle-install @@ -28,21 +28,22 @@ STRING="source /usr/local/avt_env.sh" if grep -q "$STRING" /home/$SUDO_USER/.bashrc ; then echo 'avt_env.sh already in .bashrc' else + # Default .bashrc usually has a check if shell is + # interactive, so adding at the start is a workaround echo 'Adding avt_env.sh to .bashrc' - echo "$STRING" >> /home/$SUDO_USER/.bashrc + sed -i "1i $STRING" /home/$SUDO_USER/.bashrc chown -R $SUDO_USER /home/$SUDO_USER/.bashrc chgrp -R $SUDO_USER /home/$SUDO_USER/.bashrc fi # Compile the documentation -# source the file, otherwise can't compile docs... -# TODO: source doesn't work within script, do manually as normal user -# for now -#source /home/$SUDO_USER/.bashrc -#cd tas-yagle/distrib/docxml2 -#make - -cd /home/$SUDO_USER/src -chown -R $SUDO_USER . -chgrp -R $SUDO_USER . +echo "Entering bash as $SUDO_USER to reload .bashrc and compile docs!" +runuser $SUDO_USER -c "/bin/bash << EOF +. ~/.bashrc +echo $PATH +cd /home/$SUDO_USER/src/tas-yagle/distrib/docxml2 +make +EOF" + +echo "Finished tas-yagle compilation, make sure to source .bashrc!"