Skip to content

Commit bd822bb

Browse files
committed
use $SUDO_USER when running as root
1 parent 057fcd3 commit bd822bb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

setup/debian/makedeb_xcsg.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ if [ "$EUID" -ne 0 ]
77
exit
88
fi
99

10+
# Get user's home dir (sudo's home is /root ....)
11+
USER_HOME=$(getent passwd $SUDO_USER | cut -d: -f6)
12+
1013
check_distro2(){
1114
if [[ -e /etc/redhat-release ]]
1215
then
@@ -36,7 +39,7 @@ echo "$PACKAGE_NAME *.deb build started....please wait"
3639
# CPDE_USR defines where to find the binaries to package. We don't have to check
3740
# that $CPDE_USR exists, because epm will do it and report any errors
3841
if [ -z ${CPDE_USR+x} ]; then
39-
export CPDE_USR=~/cpde_usr
42+
export CPDE_USR=$USER_HOME/cpde_usr
4043
echo "CPDE_USR is unset, defaults to '$CPDE_USR'";
4144
else
4245
echo "CPDE_USR is set to '$CPDE_USR'";

0 commit comments

Comments
 (0)