[arch-commits] Commit in filesystem/trunk (profile)

Pierre Schmitz pierre at archlinux.org
Sat Nov 20 07:34:24 UTC 2010


    Date: Saturday, November 20, 2010 @ 02:34:24
  Author: pierre
Revision: 100081

Don't try to guess the shell we are running

* Do it like Debian or Ubuntu and only source the global bashrc when running bash.
* Other shells like zsh have their own global config anyway.
* In fact sourcing the global shell config was only needed/used by bash.
* see https://bugs.archlinux.org/task/20288

Modified:
  filesystem/trunk/profile

---------+
 profile |   39 +++++++++------------------------------
 1 file changed, 9 insertions(+), 30 deletions(-)

Modified: profile
===================================================================
--- profile	2010-11-20 07:26:55 UTC (rev 100080)
+++ profile	2010-11-20 07:34:24 UTC (rev 100081)
@@ -1,31 +1,5 @@
-#
 # /etc/profile
-#
-# This file is intended to be used for ALL common
-# Bourne-compatible shells. Shell specifics should be
-# handled in /etc/profile.$SHELL where $SHELL is the name
-# of the binary being run (discounting symlinks)
-#
-# Sections taken from SuSe's /etc/profile
-# Note the explicit use of 'test' to cover all bases
-#  and potentially incompatible shells
 
-#Determine our shell without using $SHELL, which may lie
-shell="sh"
-if test -f /proc/mounts; then
-   case $(/bin/ls -l /proc/$$/exe) in
-        *bash) shell=bash ;;
-        *dash) shell=dash ;;
-        *ash)  shell=ash ;;
-        *ksh)  shell=ksh ;;
-        *zsh)  shell=zsh ;;
-    esac
-fi
-
-# Load shell specific profile settings
-test -f "/etc/profile.$shell" &&  . "/etc/profile.$shell"
-unset shell
-
 #Set our umask
 umask 022
 
@@ -35,12 +9,17 @@
 
 # Load profiles from /etc/profile.d
 if test -d /etc/profile.d/; then
-    for profile in /etc/profile.d/*.sh; do
-        test -x $profile && . $profile
-    done
-    unset profile
+	for profile in /etc/profile.d/*.sh; do
+		test -x $profile && . $profile
+	done
+	unset profile
 fi
 
+# Source global bash config
+if test "$PS1" -a "$BASH" -a -r /etc/bash.bashrc; then
+	. /etc/bash.bashrc
+fi
+
 # Termcap is outdated, old, and crusty, kill it.
 unset TERMCAP
 




More information about the arch-commits mailing list