2 # /etc/profile: system-wide profile for the Bourne shell (sh(1)) and
3 # Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
4 # Written 2003-2012 by Alexander Barton (alex@barton.de)
7 [ -e ~/.ConfigScripts.debug ] && echo " >> /etc/profile ..."
12 # Make sure UID is set
13 [ -n "$UID" ] || UID=`id -u`
16 # Indicates LC_CTYPE an UTF-8 terminal?
18 && LC_encoding="${LC_CTYPE#*.}" || LC_encoding="ISO8859-1"
19 # Set locale if it is not set or doesn't contain a dot:
20 [ "$LANG" = "${LANG#*.}" -a "$LANG" != "C" ] \
21 && export LANG="${LANG:-de_DE}.${LC_encoding}"
22 # All system messages should still be in "native" ("C") language for
24 [ -z "$GDMSESSION" -a -z "$XDG_SESSION_COOKIE" ] \
25 && export LC_MESSAGES="C"
27 unset LC_CTYPE LC_encoding 2>/dev/null
29 # Initialize PATH variable
30 if [ -x /usr/libexec/path_helper ]; then
31 eval `/usr/libexec/path_helper -s`
33 PATH="/usr/local/bin:/usr/bin:/bin"
34 [ "$UID" -eq 0 ] && PATH="/usr/local/sbin:/usr/sbin:/sbin:$PATH"
37 # prepend optional directories to PATH ...
39 for d in /Developer/usr/bin /usr/pkg/bin /usr/lib/ccache /opt/*/bin; do
40 [ -d "$d" -o -h "$d" ] && path="$path$d:"
42 [ -n "$path" ] && PATH="$path$PATH"
43 if [ "$UID" -eq 0 ]; then
45 for d in /usr/pkg/sbin /opt/*/sbin; do
46 [ -d "$d" -o -h "$d" ] && path="$path$d:"
48 [ -n "$path" ] && PATH="$path$PATH"
50 # append optional directories to PATH ...
51 for d in /usr/bin/X11 /usr/games; do
52 [ -d "$d" -o -h "$d" ] && PATH="$PATH:$d"
54 # set PATH so it includes user's private executables
55 [ -d ~/Applications ] && PATH=~/Applications:"${PATH}"
56 [ -d ~/bin ] && PATH=~/bin:"${PATH}"
57 [ -d ~/sbin ] && PATH=~/sbin:"${PATH}"
59 # Setup MANPATH, if manpath(1) isn't available
60 if [ ! "$(type manpath 2>/dev/null)" ]; then
62 && MANPATH="/usr/local/share/man:/usr/share/man:/usr/man"
64 for d in /usr/pkg/share/man /usr/pkg/man /opt/*/share/man /opt/*/man; do
65 [ -d "$d" -o -h "$d" ] && path="$path$d:"
67 [ -n "$path" ] && MANPATH="$path$MANPATH"
68 [ -d ~/share/man ] && MANPATH=~/share/man:"${MANPATH}"
69 [ -d ~/man ] && MANPATH=~/man:"${MANPATH}"
72 # set variable identifying the chroot you work in
73 [ -r /etc/debian_chroot ] && chroot_name=$(cat /etc/debian_chroot)
74 [ -r /etc/chroot_name ] && chroot_name=$(cat /etc/chroot_name)
76 # validate terminal definition
77 [ -z "$TERM" ] && eval `tset -s -Q`
79 # make sure $UID and $USER is set
80 [ -z "$UID" ] && UID=`id -u`
81 [ -z "$USER" ] && USER=`id -un`
85 ME=`hostname 2>/dev/null`
88 # Move Xauthority file to local storage, so that sudo et all work
89 if [ -z "$XAUTHORITY" -a -r ~/.Xauthority ]; then
90 cp ~/.Xauthority /tmp/Xauthority-$USER
91 chmod 600 /tmp/Xauthority-$USER
92 export XAUTHORITY="/tmp/Xauthority-$USER"
95 # read profile additions
96 if [ -d /etc/profile.d ]; then
97 for f in /etc/profile.d/*; do
98 [ -r "$f" ] || continue
103 [ -e ~/.ConfigScripts.debug ] \
110 # read local profile, if available
111 [ -r "/var/lib/${ME}/profile" ] && . /var/lib/${ME}/profile
113 # Setup some directories to use local storage (no NFS)
114 [ -d "/usr/local/home/$USER" ] \
115 || mkdir -p "/usr/local/home/$USER" >/dev/null 2>&1
116 if [ -w "/usr/local/home/$USER" ]; then
117 export LOCAL_HOME="/usr/local/home/$USER"
118 export CCACHE_DIR="$LOCAL_HOME/.ccache"
119 export XDG_CACHE_HOME="$LOCAL_HOME/.cache"
125 # generic shell prompt
131 type -p icalBuddy >/dev/null 2>&1
132 if [ $? -eq 0 -a "$UID" -ne 0 ]; then
134 *.UTF*) BUL="•"; SEP="»"; ;;
135 *) BUL="*"; SEP=">"; ;;
137 icalBuddy -f -n -npn -nc -b " $BUL " -ps "/ $SEP /" -eep "url,notes" \
138 eventsToday+1 | grep "$BUL"
142 type -p remind >/dev/null 2>&1
143 if [ $? -eq 0 -a -r ~/.remind ]; then
144 remind -h -g -t5 .remind | grep "^[0-9]"
149 # bash-specific initialization
150 [ "$BASH" -a -z "$BASHRCREAD" -a -r /etc/bash.bashrc ] \
151 && source /etc/bash.bashrc
152 [ "$BASH" -a -z "$BASHRCREAD" -a -r /etc/bashrc ] \
153 && source /etc/bashrc
155 # ksh-specific initialization
156 [ "$KSH_VERSION" -a -z "$KSHRCREAD" -a -r /etc/ksh.kshrc ] \
159 # Check filesystem quotas
160 mount 2>/dev/null | grep quota >/dev/null 2>&1
161 if [ $? -eq 0 ]; then
162 which quota >/dev/null 2>&1
163 [ $? -eq 0 ] && quota -q