t[cleanup] Fix path to user's temporary files - tomb - the crypto undertaker (HTM) git clone git://parazyd.org/tomb.git (DIR) Log (DIR) Files (DIR) Refs (DIR) README (DIR) LICENSE --- (DIR) commit 27ec914870cd4ddca9c6599e47b651535eb701ef (DIR) parent fb12b50d7d0837a11292b8eaf28af79527f7c4b7 (HTM) Author: hellekin <hellekin@cepheide.org> Date: Mon, 3 Nov 2014 17:36:52 -0300 t[cleanup] Fix path to user's temporary files Diffstat: M tomb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) --- (DIR) diff --git a/tomb b/tomb t@@ -157,18 +157,19 @@ _whoami() { typeset -gi _GID _UID typeset -g _TTY _USER + # Set username from UID or environment + [[ -n $SUDO_USER ]] && _USER=$SUDO_USER + [[ -z $_USER && -n $USERNAME ]] && _USER=$USERNAME + [[ -z $_USER ]] && _USER=$(id -u) + # Get GID from option -G or the environment option_is_set -G \ - && _GID=$(option_value -G) || _GID=$(id -g) + && _GID=$(option_value -G) || _GID=$(id -g $_USER) # Get UID from option -U or the environment option_is_set -U \ - && _UID=$(option_value -U) || _UID=$(id -u) + && _UID=$(option_value -U) || _UID=$(id -u $_USER) - # Set username from UID or environment - [[ -n $SUDO_USER ]] && _USER=$SUDO_USER - [[ -z $_USER && -n $USERNAME ]] && _USER=$USERNAME - [[ -z $_USER ]] && _USER=$(id -u) # _verbose "Identified caller: ::1 username:: (::2 UID:::::3 GID::)" \ # $_USER $_UID $_GID