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-2014 by Alexander Barton (alex@barton.de)
7 [ -e ~/.ConfigScripts.debug ] && echo " >> /etc/profile ..."
12 # Setup locale and encoding
13 if [ -e ~/.ConfigScripts.debug ]; then
14 echo " - TERM=\"$TERM\""
15 echo " - LANG=\"$LANG\""
16 echo " - LC_CTYPE=\"$LC_CTYPE\""
18 # Does LC_CTYPE or LANG indicate an UTF-8 terminal?
20 if [ -n "$LC_CTYPE" ]; then
21 LC_encoding="${LC_CTYPE#*.}"
22 elif [ -n "$LANG" ]; then
23 LC_encoding="${LANG#*.}"
25 if [ -z "$LC_encoding" ]; then
28 LC_encoding="UTF-8"; ;;
30 LC_encoding="ISO8859-1"
33 [ -e ~/.ConfigScripts.debug ] && echo " - LC_encoding=\"$LC_encoding\" (temp)"
34 # Set locale if it is not set or doesn't contain a dot:
35 [ "$LANG" = "${LANG#*.}" -a "$LANG" != "C" ] \
36 && export LANG="${LANG:-de_DE}.${LC_encoding}"
37 [ -e ~/.ConfigScripts.debug ] && echo " - LANG=\"$LANG\" (new)"
39 unset LC_CTYPE LC_encoding 2>/dev/null
41 # Initialize PATH variable
42 if [ -x /usr/libexec/path_helper ]; then
43 eval `/usr/libexec/path_helper -s \
44 | sed "s|:/usr/local/bin||" | sed "s|:/usr/local/sbin||"`
45 [[ "$PATH" == *sbin* ]] \
46 && PATH="/usr/local/bin:/usr/local/sbin:$PATH" \
47 || PATH="/usr/local/bin:$PATH"
49 PATH="/usr/local/bin:/usr/bin:/bin"
50 [ "$LOGNAME" = "root" ] && PATH="/usr/local/sbin:/usr/sbin:/sbin:$PATH"
53 # prepend optional directories to PATH ...
55 for d in /Developer/usr/bin /usr/pkg/bin /usr/ucb /usr/lib/ccache /opt/*/bin; do
56 if [ -d "$d" -o -h "$d" ]; then
57 [ -e "$d/.not_in_path" ] || path="$path$d:"
60 [ -n "$path" ] && PATH="$path$PATH"
61 if [ "$LOGNAME" = "root" ]; then
63 for d in /usr/pkg/sbin /opt/*/sbin; do
64 if [ -d "$d" -o -h "$d" ]; then
65 [ -e "$d/.not_in_path" ] || path="$path$d:"
68 [ -n "$path" ] && PATH="$path$PATH"
70 # append optional directories to PATH ...
71 for d in /usr/bin/X11 /usr/games /usr/share/php/bin; do
72 if [ -d "$d" -o -h "$d" ]; then
73 [ -e "$d/.not_in_path" ] || PATH="$PATH:$d"
76 # set PATH so it includes user's private executables
77 [ -d ~/Applications -a ! -e ~/Applications/.not_in_path ] \
78 && PATH=~/Applications:"${PATH}"
79 [ -d ~/bin -a ! -e ~/bin/.not_in_path ] \
80 && PATH=~/bin:"${PATH}"
81 [ -d ~/sbin -a ! -e ~/sbin/.not_in_path ] \
82 && PATH=~/sbin:"${PATH}"
84 # Setup MANPATH, if manpath(1) isn't available
85 if [ ! "$(type manpath 2>/dev/null)" ]; then
87 && MANPATH="/usr/local/share/man:/usr/share/man:/usr/man"
89 for d in /usr/pkg/share/man /usr/pkg/man /opt/*/share/man /opt/*/man; do
90 [ -d "$d" -o -h "$d" ] && path="$path$d:"
92 [ -n "$path" ] && MANPATH="$path$MANPATH"
93 [ -d ~/share/man ] && MANPATH=~/share/man:"${MANPATH}"
94 [ -d ~/man ] && MANPATH=~/man:"${MANPATH}"
97 # set variable identifying the chroot you work in
98 [ -r /etc/debian_chroot ] && chroot_name=$(cat /etc/debian_chroot)
99 [ -r /etc/chroot_name ] && chroot_name=$(cat /etc/chroot_name)
101 # get my own hostname
102 ME=`hostname 2>/dev/null`
105 # Move Xauthority file to local storage, so that sudo et all work
106 if [ -z "$XAUTHORITY" -a -r ~/.Xauthority ]; then
107 cp ~/.Xauthority /tmp/Xauthority-$LOGNAME
108 chmod 600 /tmp/Xauthority-$LOGNAME
109 export XAUTHORITY="/tmp/Xauthority-$LOGNAME"
112 # read profile additions
113 if [ -d /etc/profile.d -o -d /usr/local/etc/profile.d ]; then
114 for f in /etc/profile.d/* /usr/local/etc/profile.d/*; do
115 [ -r "$f" ] || continue
120 [ -e ~/.ConfigScripts.debug ] \
127 # read local profile, if available
128 [ -r "/var/lib/${ME}/profile" ] && . /var/lib/${ME}/profile
130 # Setup some directories to use local storage (no NFS)
131 [ -d "/usr/local/home/$LOGNAME" ] \
132 || ( mkdir /usr/local/home; mkdir "/usr/local/home/$LOGNAME" ) >/dev/null 2>&1
133 if [ -w "/usr/local/home/$LOGNAME" ]; then
134 export LOCAL_HOME="/usr/local/home/$LOGNAME"
135 export CCACHE_DIR="$LOCAL_HOME/.ccache"
136 export XDG_CACHE_HOME="$LOCAL_HOME/.cache"
142 # validate terminal definition
143 type -p tset >/dev/null 2>&1
144 [ $? -eq 0 ] && eval `tset -s -Q`
146 # generic shell prompt
147 [ "$LOGNAME" = "root" ] \
152 type -p icalBuddy >/dev/null 2>&1
153 if [ $? -eq 0 -a "$LOGNAME" != "root" ]; then
155 *.UTF*) bul="•"; bul_imp="!"; sep="»"; ;;
156 *) bul="*"; bul_imp="!"; sep=">"; ;;
158 icalBuddy -f -n -b " $bul " -ab " $bul_imp " -ps "/ $sep /" \
159 -nc -npn -iep "title,due" -stda \
160 tasksDueBefore:today 2>/dev/null
161 icalBuddy -f -n -b " $bul " -ab " $bul_imp " -ps "/ $sep /" \
162 -nc -npn -iep "title,datetime" \
163 eventsToday+1 2>/dev/null
165 unset bul bul_imp sep
168 type -p remind >/dev/null 2>&1
169 if [ $? -eq 0 -a -r ~/.remind ]; then
170 remind -h -g -t5 ~/.remind | \
171 grep -v '^Reminders for ' | grep -v '^$'
176 # bash-specific initialization
177 [ "$BASH" -a -z "$BASHRCREAD" -a -r /etc/bash.bashrc ] \
178 && source /etc/bash.bashrc
179 [ "$BASH" -a -z "$BASHRCREAD" -a -r /etc/bashrc ] \
180 && source /etc/bashrc
182 # ksh-specific initialization
183 [ "$KSH_VERSION" -a -z "$KSHRCREAD" -a -r /etc/ksh.kshrc ] \
186 # Check filesystem quotas
187 mount 2>/dev/null | grep quota >/dev/null 2>&1
188 if [ $? -eq 0 ]; then
189 which quota >/dev/null 2>&1
190 [ $? -eq 0 ] && quota -q