use 'who am i' rather than 'logname'

This commit is contained in:
AJ ONeal 2018-07-26 16:46:57 -06:00
parent 214096e216
commit 5908871633
1 changed files with 4 additions and 1 deletions

View File

@ -34,7 +34,10 @@ set -u
TELEBIT_DEBUG=${TELEBIT_DEBUG:-} TELEBIT_DEBUG=${TELEBIT_DEBUG:-}
# NOTE: On OS X logname works from a pipe, but on Linux it does not # NOTE: On OS X logname works from a pipe, but on Linux it does not
if [ -n "$(logname 2>/dev/null | grep '.')" ] && [ "$(logname)" != "$(id -u -n)" ]; then my_logname=$(who am i | awk '{print $1}')
#my_logname=${my_logname:-$(logname)}
#my_logname=${my_logname:-$SUDO_USER}
if [ -n "$my_logname" ] && [ "$my_logname" != "$(id -u -n)" ]; then
echo "WARNING:" echo "WARNING:"
echo " You are logged in as '$(logname)' but acting as '$(id -u -n)'." echo " You are logged in as '$(logname)' but acting as '$(id -u -n)'."
echo " If the installation is not successful please log in as '$(id -u -n)' directly." echo " If the installation is not successful please log in as '$(id -u -n)' directly."