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 if [ -d "$d" -o -h "$d" ]; then
53 [ -e "$d/.not_in_path" ] || path="$path$d:"
56 [ -n "$path" ] && PATH="$path$PATH"
57 if [ "$UID" -eq 0 ]; then
59 for d in /usr/pkg/sbin /opt/*/sbin; do
60 if [ -d "$d" -o -h "$d" ]; then
61 [ -e "$d/.not_in_path" ] || path="$path$d:"
64 [ -n "$path" ] && PATH="$path$PATH"
66 # append optional directories to PATH ...
67 for d in /usr/bin/X11 /usr/games /usr/share/php/bin; do
68 if [ -d "$d" -o -h "$d" ]; then
69 [ -e "$d/.not_in_path" ] || PATH="$PATH:$d"
72 # set PATH so it includes user's private executables
73 [ -d ~/Applications -a ! -e ~/Applications/.not_in_path ] \
74 && PATH=~/Applications:"${PATH}"
75 [ -d ~/bin -a ! -e ~/bin/.not_in_path ] \
76 && PATH=~/bin:"${PATH}"
77 [ -d ~/sbin -a ! -e ~/sbin/.not_in_path ] \
78 && PATH=~/sbin:"${PATH}"
80 # Setup MANPATH, if manpath(1) isn't available
81 if [ ! "$(type manpath 2>/dev/null)" ]; then
83 && MANPATH="/usr/local/share/man:/usr/share/man:/usr/man"
85 for d in /usr/pkg/share/man /usr/pkg/man /opt/*/share/man /opt/*/man; do
86 [ -d "$d" -o -h "$d" ] && path="$path$d:"
88 [ -n "$path" ] && MANPATH="$path$MANPATH"
89 [ -d ~/share/man ] && MANPATH=~/share/man:"${MANPATH}"
90 [ -d ~/man ] && MANPATH=~/man:"${MANPATH}"
93 # set variable identifying the chroot you work in
94 [ -r /etc/debian_chroot ] && chroot_name=$(cat /etc/debian_chroot)
95 [ -r /etc/chroot_name ] && chroot_name=$(cat /etc/chroot_name)
97 # make sure $UID and $USER is set
98 [ -z "$UID" ] && UID=`id -u`
99 [ -z "$USER" ] && USER=`id -un`
102 # get my own hostname
103 ME=`hostname 2>/dev/null`
106 # Move Xauthority file to local storage, so that sudo et all work
107 if [ -z "$XAUTHORITY" -a -r ~/.Xauthority ]; then
108 cp ~/.Xauthority /tmp/Xauthority-$USER
109 chmod 600 /tmp/Xauthority-$USER
110 export XAUTHORITY="/tmp/Xauthority-$USER"
113 # read profile additions
114 if [ -d /etc/profile.d -o -d /usr/local/etc/profile.d ]; then
115 for f in /etc/profile.d/* /usr/local/etc/profile.d/*; do
116 [ -r "$f" ] || continue
121 [ -e ~/.ConfigScripts.debug ] \
128 # read local profile, if available
129 [ -r "/var/lib/${ME}/profile" ] && . /var/lib/${ME}/profile
131 # Setup some directories to use local storage (no NFS)
132 [ -d "/usr/local/home/$USER" ] \
133 || ( mkdir /usr/local/home; mkdir "/usr/local/home/$USER" ) >/dev/null 2>&1
134 if [ -w "/usr/local/home/$USER" ]; then
135 export LOCAL_HOME="/usr/local/home/$USER"
136 export CCACHE_DIR="$LOCAL_HOME/.ccache"
137 export XDG_CACHE_HOME="$LOCAL_HOME/.cache"
143 # validate terminal definition
144 type -p tset >/dev/null 2>&1
145 [ $? -eq 0 ] && eval `tset -s -Q`
147 # generic shell prompt
153 type -p icalBuddy >/dev/null 2>&1
154 if [ $? -eq 0 -a "$UID" -ne 0 ]; then
156 *.UTF*) BUL="•"; SEP="»"; ;;
157 *) BUL="*"; SEP=">"; ;;
159 icalBuddy -f -n -npn -nc -b " $BUL " -ps "/ $SEP /" -eep "url,notes" \
160 eventsToday+1 2>/dev/null | grep "$BUL"
164 type -p remind >/dev/null 2>&1
165 if [ $? -eq 0 -a -r ~/.remind ]; then
166 remind -h -g -t5 ~/.remind | \
167 grep -v '^Reminders for ' | grep -v '^$'
172 # bash-specific initialization
173 [ "$BASH" -a -z "$BASHRCREAD" -a -r /etc/bash.bashrc ] \
174 && source /etc/bash.bashrc
175 [ "$BASH" -a -z "$BASHRCREAD" -a -r /etc/bashrc ] \
176 && source /etc/bashrc
178 # ksh-specific initialization
179 [ "$KSH_VERSION" -a -z "$KSHRCREAD" -a -r /etc/ksh.kshrc ] \
182 # Check filesystem quotas
183 mount 2>/dev/null | grep quota >/dev/null 2>&1
184 if [ $? -eq 0 ]; then
185 which quota >/dev/null 2>&1
186 [ $? -eq 0 ] && quota -q