summaryrefslogtreecommitdiffstats
path: root/core/rootfs
diff options
context:
space:
mode:
authorSimon Rettberg2021-10-29 15:40:56 +0200
committerSimon Rettberg2021-10-29 15:40:56 +0200
commit061365a80c9291fddb41c2ccd7132272b9930847 (patch)
tree444c6d096a85fe00b7af4df4b2474601bfbe5dae /core/rootfs
parent[pam-slx-plug] Unmount doubly-mounted home directory (diff)
downloadmltk-061365a80c9291fddb41c2ccd7132272b9930847.tar.gz
mltk-061365a80c9291fddb41c2ccd7132272b9930847.tar.xz
mltk-061365a80c9291fddb41c2ccd7132272b9930847.zip
[rootfs-stage32] /etc/profile: Only source bashrc on bash
Diffstat (limited to 'core/rootfs')
-rw-r--r--core/rootfs/rootfs-stage32/data/etc/profile43
1 files changed, 23 insertions, 20 deletions
diff --git a/core/rootfs/rootfs-stage32/data/etc/profile b/core/rootfs/rootfs-stage32/data/etc/profile
index 125e7195..b50b1693 100644
--- a/core/rootfs/rootfs-stage32/data/etc/profile
+++ b/core/rootfs/rootfs-stage32/data/etc/profile
@@ -4,11 +4,31 @@
export UID=`id -u` 2> /dev/null
+# Stuff we might wanna know
+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
+unset PWENT
+
# If running interactively, then:
-if [ "$PS1" ]; then
+if [ "${PS1-}" ]; then
- if [ "$BASH" ]; then
+ if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then
export PS1="[\u@\h \W]\\$ "
+ if [ -s /etc/bash.bashrc ]; then
+ . /etc/bash.bashrc
+ fi
+ if [ -s "$HOME/.bashrc" ]; then
+ . "$HOME/.bashrc"
+ fi
else
if [ "$UID" -eq 0 ]; then
export PS1='# '
@@ -22,24 +42,10 @@ if [ "$PS1" ]; then
export PAGER='/bin/less'
export EDITOR='/bin/vi'
export INPUTRC=/etc/inputrc
- #export DMALLOC_OPTIONS=debug=0x34f47d83,inter=100,log=logfile
export TERMINFO='/lib/terminfo'
fi
-# Stuff we might wanna know
-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
@@ -49,12 +55,9 @@ for i in /etc/profile.d/*.sh ; do
. "$i"
fi
done
+unset i
# Sourcing /etc/profile.local - please add custom stuff to profile.local
# as /etc/profile may be overwritten by system updates
test -s /etc/profile.local && . /etc/profile.local
-if [ -s "$HOME/.bashrc" ]; then
- . "$HOME/.bashrc"
-fi
-