diff options
author | Simon Rettberg | 2018-01-18 13:46:35 +0100 |
---|---|---|
committer | Simon Rettberg | 2018-01-18 13:46:35 +0100 |
commit | 01e008a9577155f6b0875b207e42f1c2bbd087f4 (patch) | |
tree | d505e3236867c6953e25b4ebd5a4f1b606c217a1 /core/rootfs/rootfs-stage32/data | |
parent | [run-virt] add --sync to slxlog calls (diff) | |
download | mltk-01e008a9577155f6b0875b207e42f1c2bbd087f4.tar.gz mltk-01e008a9577155f6b0875b207e42f1c2bbd087f4.tar.xz mltk-01e008a9577155f6b0875b207e42f1c2bbd087f4.zip |
Fix UID/USER ambiguity in several places
Diffstat (limited to 'core/rootfs/rootfs-stage32/data')
-rw-r--r-- | core/rootfs/rootfs-stage32/data/etc/profile | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/core/rootfs/rootfs-stage32/data/etc/profile b/core/rootfs/rootfs-stage32/data/etc/profile index cbc5dba2..125e7195 100644 --- a/core/rootfs/rootfs-stage32/data/etc/profile +++ b/core/rootfs/rootfs-stage32/data/etc/profile @@ -28,13 +28,17 @@ if [ "$PS1" ]; then fi # Stuff we might wanna know -PWENT=`getent passwd $USER` -export USER=`echo "$PWENT" | awk -F ':' '{print $1}'` -export GID=`echo "$PWENT" | awk -F ':' '{print $4}'` -export HOME=`echo "$PWENT" | awk -F ':' '{print $6}'` -export GROUP=`id -gn` -export LOGNAME=$USER -export HOSTNAME=`hostname` +PWENT= +[ -n "$UID" ] && PWENT=`getent passwd "$UID"` +[ -z "$PWENT" ] && [ -n "$USER" ] && PWENT=`getent passwd "$USER"` +if [ -n "$PWENT" ]; then + export USER=`echo "$PWENT" | awk -F ':' '{print $1}'` + export GID=`echo "$PWENT" | awk -F ':' '{print $4}'` + export HOME=`echo "$PWENT" | awk -F ':' '{print $6}'` + export GROUP=`id -gn` + export LOGNAME=$USER + export HOSTNAME=`hostname` +fi # set TERM to xterm on SSH sessions [ -n "$SSH_TTY" ] && export TERM=xterm @@ -42,7 +46,7 @@ export HOSTNAME=`hostname` # Source configuration files from /etc/profile.d for i in /etc/profile.d/*.sh ; do if [ -r "$i" ]; then - . $i + . "$i" fi done |