-# 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!"