base-files: sanitize and unify $PATH
[openwrt/staging/mkresin.git] / package / base-files / files / etc / profile
index 282a747e5248760901e4ddbfc392c7a14ca6ff7d..bd008a84d70fad6cf50fa74be5b0906e92161889 100644 (file)
@@ -1,7 +1,8 @@
 #!/bin/sh
 [ -f /etc/banner ] && cat /etc/banner
+[ -e /tmp/.failsafe ] && cat /etc/banner.failsafe
 
-export PATH=/bin:/sbin:/usr/bin:/usr/sbin
+export PATH=/usr/sbin:/usr/bin:/sbin:/bin
 export HOME=$(grep -e "^${USER:-root}:" /etc/passwd | cut -d ":" -f 6)
 export HOME=${HOME:-/root}
 export PS1='\u@\h:\w\$ '
@@ -12,4 +13,11 @@ export PS1='\u@\h:\w\$ '
 [ -z "$KSH_VERSION" -o \! -s /etc/mkshrc ] || . /etc/mkshrc
 
 [ -x /usr/bin/arp ] || arp() { cat /proc/net/arp; }
-[ -z /usr/bin/ldd ] || ldd() { LD_TRACE_LOADED_OBJECTS=1 $*; }
+[ -x /usr/bin/ldd ] || ldd() { LD_TRACE_LOADED_OBJECTS=1 $*; }
+
+[ -n "$FAILSAFE" ] || {
+       for FILE in /etc/profile.d/*.sh; do
+               [ -e "$FILE" ] && . "$FILE"
+       done
+       unset FILE
+}