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"
62 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"
71 # append optional directories to PATH ...
72 for d in /usr/bin/X11 /usr/games /usr/share/php/bin; do
73 if [ -d "$d" -o -h "$d" ]; then
74 [ -e "$d/.not_in_path" ] || PATH="$PATH:$d"
78 # set PATH so it includes user's private executables
79 [ -d ~/Applications -a ! -e ~/Applications/.not_in_path ] \
80 && PATH=~/Applications:"${PATH}"
81 [ -d ~/bin -a ! -e ~/bin/.not_in_path ] \
82 && PATH=~/bin:"${PATH}"
83 [ -d ~/sbin -a ! -e ~/sbin/.not_in_path ] \
84 && PATH=~/sbin:"${PATH}"
86 # Setup MANPATH, if manpath(1) isn't available
87 if [ ! "$(type manpath 2>/dev/null)" ]; then
89 && MANPATH="/usr/local/share/man:/usr/share/man:/usr/man"
91 for d in /usr/pkg/share/man /usr/pkg/man /opt/*/share/man /opt/*/man; do
92 [ -d "$d" -o -h "$d" ] && path="$path$d:"
94 [ -n "$path" ] && MANPATH="$path$MANPATH"
95 [ -d ~/share/man ] && MANPATH=~/share/man:"${MANPATH}"
96 [ -d ~/man ] && MANPATH=~/man:"${MANPATH}"
100 # set variable identifying the chroot you work in
101 [ -r /etc/debian_chroot ] && chroot_name=$(cat /etc/debian_chroot)
102 [ -r /etc/chroot_name ] && chroot_name=$(cat /etc/chroot_name)
104 # get my own hostname
105 [ -n "$HOSTNAME" ] || HOSTNAME=`hostname 2>/dev/null`
108 # Move Xauthority file to local storage, so that sudo et all work
109 if [ -z "$XAUTHORITY" -a -r ~/.Xauthority ]; then
110 cp ~/.Xauthority /tmp/Xauthority-$LOGNAME
111 chmod 600 /tmp/Xauthority-$LOGNAME
112 export XAUTHORITY="/tmp/Xauthority-$LOGNAME"
115 # read profile additions
116 if [ -d /etc/profile.d -o -d /usr/local/etc/profile.d ]; then
117 for f in /etc/profile.d/* /usr/local/etc/profile.d/*; do
118 [ -r "$f" ] || continue
123 [ -e ~/.ConfigScripts.debug ] \
131 # read local profile, if available
132 [ -r "/var/lib/${HOSTNAME}/profile" ] && . /var/lib/${HOSTNAME}/profile
134 # Setup some directories to use local storage (no NFS)
135 [ -d "/usr/local/home/$LOGNAME" ] \
136 || ( mkdir /usr/local/home; mkdir "/usr/local/home/$LOGNAME" ) >/dev/null 2>&1
137 if [ -w "/usr/local/home/$LOGNAME" ]; then
138 export LOCAL_HOME="/usr/local/home/$LOGNAME"
139 export CCACHE_DIR="$LOCAL_HOME/.ccache"
140 export XDG_CACHE_HOME="$LOCAL_HOME/.cache"
146 # validate terminal definition
147 type tset >/dev/null 2>&1 && eval `tset -s -Q`
149 # generic shell prompt
150 [ "$LOGNAME" = "root" ] \
151 && PS1="<$HOSTNAME> # " \
152 || PS1="<$HOSTNAME> \$ "
154 # Reminders (once every 60 minutes)
155 if [ -z `find ~/.last_reminder -mmin -60 2>/dev/null` ]; then
156 [ -e ~/.ConfigScripts.debug ] && echo " - Reminders ..."
157 type icalBuddy >/dev/null 2>&1
158 if [ $? -eq 0 -a "$LOGNAME" != "root" ]; then
161 *.UTF*) bul="•"; bul_imp="!"; sep="»"; ;;
162 *) bul="*"; bul_imp="!"; sep=">"; ;;
164 icalBuddy -f -n -b " $bul " -ab " $bul_imp " -ps "/ $sep /" \
165 -nc -npn -iep "title,due" -stda \
166 tasksDueBefore:today 2>/dev/null
167 icalBuddy -f -n -b " $bul " -ab " $bul_imp " -ps "/ $sep /" \
168 -nc -npn -iep "title,datetime" \
169 eventsToday+1 2>/dev/null
171 unset bul bul_imp sep
174 type remind >/dev/null 2>&1
175 if [ $? -eq 0 -a -r ~/.remind ]; then
176 remind -h -g -t5 ~/.remind | \
177 grep -v '^Reminders for ' | grep -v '^$'
181 touch ~/.last_reminder
184 # bash-specific initialization
185 [ "$BASH" -a -z "$BASHRCREAD" -a -r /etc/bash.bashrc ] \
186 && source /etc/bash.bashrc
187 [ "$BASH" -a -z "$BASHRCREAD" -a -r /etc/bashrc ] \
188 && source /etc/bashrc
190 # ksh-specific initialization
191 [ "$KSH_VERSION" -a -z "$KSHRCREAD" -a -r /etc/ksh.kshrc ] \
194 # Check filesystem quotas
195 mount 2>/dev/null | grep quota >/dev/null 2>&1
196 if [ $? -eq 0 ]; then
197 type quota >/dev/null 2>&1 && quota -q