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?
17 if [ -n "$LC_CTYPE" ]; then
18 LC_encoding="${LC_CTYPE#*.}"
22 LC_encoding="UTF-8"; ;;
24 LC_encoding="ISO8859-1"
27 # Set locale if it is not set or doesn't contain a dot:
28 [ "$LANG" = "${LANG#*.}" -a "$LANG" != "C" ] \
29 && export LANG="${LANG:-de_DE}.${LC_encoding}"
30 # All system messages should still be in "native" ("C") language for
32 [ -z "$GDMSESSION" -a -z "$XDG_SESSION_COOKIE" ] \
33 && export LC_MESSAGES="C"
35 unset LC_CTYPE LC_encoding 2>/dev/null
37 # Initialize PATH variable
38 if [ -x /usr/libexec/path_helper ]; then
39 eval `/usr/libexec/path_helper -s \
40 | sed "s|:/usr/local/bin||" | sed "s|:/usr/local/sbin||"`
41 [[ "$PATH" == *sbin* ]] \
42 && PATH="/usr/local/bin:/usr/local/sbin:$PATH" \
43 || PATH="/usr/local/bin:$PATH"
45 PATH="/usr/local/bin:/usr/bin:/bin"
46 [ "$UID" -eq 0 ] && PATH="/usr/local/sbin:/usr/sbin:/sbin:$PATH"
49 # prepend optional directories to PATH ...
51 for d in /Developer/usr/bin /usr/pkg/bin /usr/ucb /usr/lib/ccache /opt/*/bin; do
52 [ -d "$d" -o -h "$d" ] && path="$path$d:"
54 [ -n "$path" ] && PATH="$path$PATH"
55 if [ "$UID" -eq 0 ]; then
57 for d in /usr/pkg/sbin /opt/*/sbin; do
58 [ -d "$d" -o -h "$d" ] && path="$path$d:"
60 [ -n "$path" ] && PATH="$path$PATH"
62 # append optional directories to PATH ...
63 for d in /usr/bin/X11 /usr/games /usr/share/php/bin; do
64 [ -d "$d" -o -h "$d" ] && PATH="$PATH:$d"
66 # set PATH so it includes user's private executables
67 [ -d ~/Applications ] && PATH=~/Applications:"${PATH}"
68 [ -d ~/bin ] && PATH=~/bin:"${PATH}"
69 [ -d ~/sbin ] && PATH=~/sbin:"${PATH}"
71 # Setup MANPATH, if manpath(1) isn't available
72 if [ ! "$(type manpath 2>/dev/null)" ]; then
74 && MANPATH="/usr/local/share/man:/usr/share/man:/usr/man"
76 for d in /usr/pkg/share/man /usr/pkg/man /opt/*/share/man /opt/*/man; do
77 [ -d "$d" -o -h "$d" ] && path="$path$d:"
79 [ -n "$path" ] && MANPATH="$path$MANPATH"
80 [ -d ~/share/man ] && MANPATH=~/share/man:"${MANPATH}"
81 [ -d ~/man ] && MANPATH=~/man:"${MANPATH}"
84 # set variable identifying the chroot you work in
85 [ -r /etc/debian_chroot ] && chroot_name=$(cat /etc/debian_chroot)
86 [ -r /etc/chroot_name ] && chroot_name=$(cat /etc/chroot_name)
88 # make sure $UID and $USER is set
89 [ -z "$UID" ] && UID=`id -u`
90 [ -z "$USER" ] && USER=`id -un`
94 ME=`hostname 2>/dev/null`
97 # Move Xauthority file to local storage, so that sudo et all work
98 if [ -z "$XAUTHORITY" -a -r ~/.Xauthority ]; then
99 cp ~/.Xauthority /tmp/Xauthority-$USER
100 chmod 600 /tmp/Xauthority-$USER
101 export XAUTHORITY="/tmp/Xauthority-$USER"
104 # read profile additions
105 if [ -d /etc/profile.d -o -d /usr/local/etc/profile.d ]; then
106 for f in /etc/profile.d/* /usr/local/etc/profile.d/*; do
107 [ -r "$f" ] || continue
112 [ -e ~/.ConfigScripts.debug ] \
119 # read local profile, if available
120 [ -r "/var/lib/${ME}/profile" ] && . /var/lib/${ME}/profile
122 # Setup some directories to use local storage (no NFS)
123 [ -d "/usr/local/home/$USER" ] \
124 || ( mkdir /usr/local/home; mkdir "/usr/local/home/$USER" ) >/dev/null 2>&1
125 if [ -w "/usr/local/home/$USER" ]; then
126 export LOCAL_HOME="/usr/local/home/$USER"
127 export CCACHE_DIR="$LOCAL_HOME/.ccache"
128 export XDG_CACHE_HOME="$LOCAL_HOME/.cache"
134 # validate terminal definition
137 # generic shell prompt
143 type -p icalBuddy >/dev/null 2>&1
144 if [ $? -eq 0 -a "$UID" -ne 0 ]; then
146 *.UTF*) BUL="•"; SEP="»"; ;;
147 *) BUL="*"; SEP=">"; ;;
149 icalBuddy -f -n -npn -nc -b " $BUL " -ps "/ $SEP /" -eep "url,notes" \
150 eventsToday+1 2>/dev/null | grep "$BUL"
154 type -p remind >/dev/null 2>&1
155 if [ $? -eq 0 -a -r ~/.remind ]; then
156 remind -h -g -t5 ~/.remind | \
157 grep -v '^Reminders for ' | grep -v '^$'
162 # bash-specific initialization
163 [ "$BASH" -a -z "$BASHRCREAD" -a -r /etc/bash.bashrc ] \
164 && source /etc/bash.bashrc
165 [ "$BASH" -a -z "$BASHRCREAD" -a -r /etc/bashrc ] \
166 && source /etc/bashrc
168 # ksh-specific initialization
169 [ "$KSH_VERSION" -a -z "$KSHRCREAD" -a -r /etc/ksh.kshrc ] \
172 # Check filesystem quotas
173 mount 2>/dev/null | grep quota >/dev/null 2>&1
174 if [ $? -eq 0 ]; then
175 which quota >/dev/null 2>&1
176 [ $? -eq 0 ] && quota -q