Skip to content

Commit

Permalink
use $SUDO_USER when running as root
Browse files Browse the repository at this point in the history
  • Loading branch information
arnholm committed Dec 12, 2020
1 parent 057fcd3 commit bd822bb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion setup/debian/makedeb_xcsg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ if [ "$EUID" -ne 0 ]
exit
fi

# Get user's home dir (sudo's home is /root ....)
USER_HOME=$(getent passwd $SUDO_USER | cut -d: -f6)

check_distro2(){
if [[ -e /etc/redhat-release ]]
then
Expand Down Expand Up @@ -36,7 +39,7 @@ echo "$PACKAGE_NAME *.deb build started....please wait"
# CPDE_USR defines where to find the binaries to package. We don't have to check
# that $CPDE_USR exists, because epm will do it and report any errors
if [ -z ${CPDE_USR+x} ]; then
export CPDE_USR=~/cpde_usr
export CPDE_USR=$USER_HOME/cpde_usr
echo "CPDE_USR is unset, defaults to '$CPDE_USR'";
else
echo "CPDE_USR is set to '$CPDE_USR'";
Expand Down

0 comments on commit bd822bb

Please sign in to comment.