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 \
32 | sed "s|:/usr/local/bin||" | sed "s|:/usr/local/sbin||"`
33 [[ "$PATH" == *sbin* ]] \
34 && PATH="/usr/local/bin:/usr/local/sbin:$PATH" \
35 || PATH="/usr/local/bin:$PATH"
37 PATH="/usr/local/bin:/usr/bin:/bin"
38 [ "$UID" -eq 0 ] && PATH="/usr/local/sbin:/usr/sbin:/sbin:$PATH"
41 # prepend optional directories to PATH ...
43 for d in /Developer/usr/bin /usr/pkg/bin /usr/ucb /usr/lib/ccache /opt/*/bin; do
44 [ -d "$d" -o -h "$d" ] && path="$path$d:"
46 [ -n "$path" ] && PATH="$path$PATH"
47 if [ "$UID" -eq 0 ]; then
49 for d in /usr/pkg/sbin /opt/*/sbin; do
50 [ -d "$d" -o -h "$d" ] && path="$path$d:"
52 [ -n "$path" ] && PATH="$path$PATH"
54 # append optional directories to PATH ...
55 for d in /usr/bin/X11 /usr/games /usr/share/php/bin; do
56 [ -d "$d" -o -h "$d" ] && PATH="$PATH:$d"
58 # set PATH so it includes user's private executables
59 [ -d ~/Applications ] && PATH=~/Applications:"${PATH}"
60 [ -d ~/bin ] && PATH=~/bin:"${PATH}"
61 [ -d ~/sbin ] && PATH=~/sbin:"${PATH}"
63 # Setup MANPATH, if manpath(1) isn't available
64 if [ ! "$(type manpath 2>/dev/null)" ]; then
66 && MANPATH="/usr/local/share/man:/usr/share/man:/usr/man"
68 for d in /usr/pkg/share/man /usr/pkg/man /opt/*/share/man /opt/*/man; do
69 [ -d "$d" -o -h "$d" ] && path="$path$d:"
71 [ -n "$path" ] && MANPATH="$path$MANPATH"
72 [ -d ~/share/man ] && MANPATH=~/share/man:"${MANPATH}"
73 [ -d ~/man ] && MANPATH=~/man:"${MANPATH}"
76 # set variable identifying the chroot you work in
77 [ -r /etc/debian_chroot ] && chroot_name=$(cat /etc/debian_chroot)
78 [ -r /etc/chroot_name ] && chroot_name=$(cat /etc/chroot_name)
80 # make sure $UID and $USER is set
81 [ -z "$UID" ] && UID=`id -u`
82 [ -z "$USER" ] && USER=`id -un`
86 ME=`hostname 2>/dev/null`
89 # Move Xauthority file to local storage, so that sudo et all work
90 if [ -z "$XAUTHORITY" -a -r ~/.Xauthority ]; then
91 cp ~/.Xauthority /tmp/Xauthority-$USER
92 chmod 600 /tmp/Xauthority-$USER
93 export XAUTHORITY="/tmp/Xauthority-$USER"
96 # read profile additions
97 if [ -d /etc/profile.d -o -d /usr/local/etc/profile.d ]; then
98 for f in /etc/profile.d/* /usr/local/etc/profile.d/*; do
99 [ -r "$f" ] || continue
104 [ -e ~/.ConfigScripts.debug ] \
111 # read local profile, if available
112 [ -r "/var/lib/${ME}/profile" ] && . /var/lib/${ME}/profile
114 # Setup some directories to use local storage (no NFS)
115 [ -d "/usr/local/home/$USER" ] \
116 || ( mkdir /usr/local/home; mkdir "/usr/local/home/$USER" ) >/dev/null 2>&1
117 if [ -w "/usr/local/home/$USER" ]; then
118 export LOCAL_HOME="/usr/local/home/$USER"
119 export CCACHE_DIR="$LOCAL_HOME/.ccache"
120 export XDG_CACHE_HOME="$LOCAL_HOME/.cache"
126 # validate terminal definition
129 # generic shell prompt
135 type -p icalBuddy >/dev/null 2>&1
136 if [ $? -eq 0 -a "$UID" -ne 0 ]; then
138 *.UTF*) BUL="•"; SEP="»"; ;;
139 *) BUL="*"; SEP=">"; ;;
141 icalBuddy -f -n -npn -nc -b " $BUL " -ps "/ $SEP /" -eep "url,notes" \
142 eventsToday+1 2>/dev/null | grep "$BUL"
146 type -p remind >/dev/null 2>&1
147 if [ $? -eq 0 -a -r ~/.remind ]; then
148 remind -h -g -t5 ~/.remind | \
149 grep -v '^Reminders for ' | grep -v '^$'
154 # bash-specific initialization
155 [ "$BASH" -a -z "$BASHRCREAD" -a -r /etc/bash.bashrc ] \
156 && source /etc/bash.bashrc
157 [ "$BASH" -a -z "$BASHRCREAD" -a -r /etc/bashrc ] \
158 && source /etc/bashrc
160 # ksh-specific initialization
161 [ "$KSH_VERSION" -a -z "$KSHRCREAD" -a -r /etc/ksh.kshrc ] \
164 # Check filesystem quotas
165 mount 2>/dev/null | grep quota >/dev/null 2>&1
166 if [ $? -eq 0 ]; then
167 which quota >/dev/null 2>&1
168 [ $? -eq 0 ] && quota -q