]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - config/etc/profile
Merge branch 'iptables-upnpfw' into core67-merge
[ipfire-2.x.git] / config / etc / profile
index 6804fc42fc13a304e445dca1c89c65594f26387b..2d66685588f07b8aeacf77624beb1909532c159a 100644 (file)
@@ -1,49 +1,78 @@
-# /etc/bashrc
+# /etc/profile
 
-umask 022
-unset i
+# System wide environment and startup programs, for login setup
+# Functions and aliases go in /etc/bashrc
 
-# are we an interactive shell?
-if [ "$PS1" ]; then
-    if [ -x /usr/bin/tput ]; then
-      if [ "x`tput kbs`" != "x" ]; then # We can't do this with "dumb" terminal
-        stty erase `tput kbs`
-      elif [ -x /usr/bin/wc ]; then
-        if [ "`tput kbs|wc -c `" -gt 0 ]; then # We can't do this with "dumb" terminal
-          stty erase `tput kbs`
-        fi
-      fi
-    fi
-fi
+# It's NOT a good idea to change this file unless you know what you
+# are doing. It's much better to create a custom.sh shell script in
+# /etc/profile.d/ to make custom changes to your environment, as this
+# will prevent the need for merging in future updates.
 
-# Path manipulation
-PATH="/sbin:/usr/sbin:/usr/local/sbin:/bin:/usr/bin:/usr/local/bin"
+pathmunge () {
+    case ":${PATH}:" in
+        *:"$1":*)
+            ;;
+        *)
+            if [ "$2" = "after" ] ; then
+                PATH=$PATH:$1
+            else
+                PATH=$1:$PATH
+            fi
+    esac
+}
 
-# No core files by default
-ulimit -S -c 0 > /dev/null 2>&1
 
-USER=`id -un`
-LOGNAME=$USER
+if [ -x /usr/bin/id ]; then
+    if [ -z "$EUID" ]; then
+        # ksh workaround
+        EUID=`id -u`
+        UID=`id -ru`
+    fi
+    USER="`id -un`"
+    LOGNAME=$USER
+    MAIL="/var/spool/mail/$USER"
+fi
 
-HOSTNAME=`/bin/hostname`
-HISTSIZE=250
+# Path manipulation
+if [ "$EUID" = "0" ]; then
+    pathmunge /sbin
+    pathmunge /usr/sbin
+    pathmunge /usr/local/sbin
+else
+    pathmunge /usr/local/sbin after
+    pathmunge /usr/sbin after
+    pathmunge /sbin after
+fi
 
-if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
-    INPUTRC=/etc/inputrc
+HOSTNAME=`/bin/hostname 2>/dev/null`
+HISTSIZE=1000
+if [ "$HISTCONTROL" = "ignorespace" ] ; then
+    export HISTCONTROL=ignoreboth
+else
+    export HISTCONTROL=ignoredups
 fi
 
-export PATH USER LOGNAME HOSTNAME HISTSIZE INPUTRC 
+export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL
 
-# LS Colors
-alias dir='ls'
-alias ll='ls -l --color=tty'
-alias ls='ls --color=tty'
+# By default, we want umask to get set. This sets it for login shell
+# Current threshold for system reserved uid/gids is 200
+# You could check uidgid reservation validity in
+# /usr/share/doc/setup-*/uidgid file
+if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then
+    umask 002
+else
+    umask 022
+fi
 
-# IPFire language settings
-LANG=en_US.utf8
-PS1='\[\033[1;33m\]\u\[\033[1;37m\]@\[\033[1;32m\]\h\[\033[1;37m\]:\[\033[1;31m\]\w \[\033[1;36m\]\$ \[\033[0m\]'
-echo -n -e '\033%G'
+for i in /etc/profile.d/*.sh ; do
+    if [ -r "$i" ]; then
+        if [ "${-#*i}" != "$-" ]; then 
+            . "$i"
+        else
+            . "$i" >/dev/null 2>&1
+        fi
+    fi
+done
 
-export LANG PS1
-export TERM=linux
-export COLORTERM=1
+unset i
+unset pathmunge