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-2015 by Alexander Barton (alex@barton.de)
7 [ -e ~/.ConfigScripts.debug ] && echo " .. /etc/profile ..."
12 [ -e ~/.ConfigScripts.debug ] && echo " >> /etc/profile ..."
14 # Setup locale and encoding
15 if [ -e ~/.ConfigScripts.debug ]; then
16 echo " - TERM=\"$TERM\""
17 echo " - LANG=\"$LANG\""
18 echo " - LC_CTYPE=\"$LC_CTYPE\""
20 # Does LC_CTYPE or LANG indicate an UTF-8 terminal?
22 if [ -n "$LC_CTYPE" ]; then
23 LC_encoding=`echo "$LC_CTYPE" | cut -d. -f2- -s`
24 elif [ -n "$LANG" ]; then
25 LC_encoding=`echo "$LANG" | cut -d. -f2- -s`
27 if [ -z "$LC_encoding" ]; then
30 LC_encoding="UTF-8"; ;;
32 LC_encoding="ISO8859-1"
35 [ -e ~/.ConfigScripts.debug ] && echo " - LC_encoding=\"$LC_encoding\" (temp)"
36 # Set locale if it is not set or doesn't contain a dot:
37 [ "$LANG" = "${LANG#*.}" -a "$LANG" != "C" ] \
38 && export LANG="${LANG:-de_DE}.${LC_encoding}"
39 [ -e ~/.ConfigScripts.debug ] && echo " - LANG=\"$LANG\" (new)"
41 unset LC_CTYPE LC_encoding 2>/dev/null
43 # Initialize PATH variable
44 if [ -x /usr/libexec/path_helper ]; then
45 eval `/usr/libexec/path_helper -s \
46 | sed "s|:/usr/local/bin||" | sed "s|:/usr/local/sbin||"`
47 [[ "$PATH" == *sbin* ]] \
48 && PATH="/usr/local/bin:/usr/local/sbin:$PATH" \
49 || PATH="/usr/local/bin:$PATH"
51 PATH="/usr/local/bin:/usr/bin:/bin"
52 [ "$LOGNAME" = "root" ] && PATH="/usr/local/sbin:/usr/sbin:/sbin:$PATH"
55 # prepend optional directories to PATH ...
58 /usr/local/opt/ccache/libexec \
65 if [ -d "$d" -o -h "$d" ]; then
66 [ -e "$d/.not_in_path" ] || path="$path$d:"
69 [ -n "$path" ] && PATH="$path$PATH"
71 if [ "$LOGNAME" = "root" ]; then
76 if [ -d "$d" -o -h "$d" ]; then
77 [ -e "$d/.not_in_path" ] || path="$path$d:"
80 [ -n "$path" ] && PATH="$path$PATH"
83 # append optional directories to PATH ...
89 if [ -d "$d" -o -h "$d" ]; then
90 [ -e "$d/.not_in_path" ] || PATH="$PATH:$d"
94 # set PATH so it includes user's private executables
95 [ -d ~/Applications -a ! -e ~/Applications/.not_in_path ] \
96 && PATH=~/Applications:"${PATH}"
97 [ -d ~/bin -a ! -e ~/bin/.not_in_path ] \
98 && PATH=~/bin:"${PATH}"
99 [ -d ~/sbin -a ! -e ~/sbin/.not_in_path ] \
100 && PATH=~/sbin:"${PATH}"
102 # Setup MANPATH, if manpath(1) isn't available
103 if [ ! "$(type -t manpath 2>/dev/null)" ]; then
105 && MANPATH="/usr/local/share/man:/usr/share/man:/usr/man"
113 [ -d "$d" -o -h "$d" ] && path="$path$d:"
115 [ -n "$path" ] && MANPATH="$path$MANPATH"
116 [ -d ~/share/man ] && MANPATH=~/share/man:"${MANPATH}"
117 [ -d ~/man ] && MANPATH=~/man:"${MANPATH}"
121 # set variable identifying the chroot you work in
122 [ -r /etc/debian_chroot ] && chroot_name=$(cat /etc/debian_chroot)
123 [ -r /etc/chroot_name ] && chroot_name=$(cat /etc/chroot_name)
125 # get my own hostname
126 [ -n "$HOSTNAME" ] || HOSTNAME=`hostname 2>/dev/null`
129 # Setup local home directory, when available
130 [ -d "/usr/local/home" -a ! -d "/usr/local/home/$LOGNAME" ] \
131 && mkdir "/usr/local/home/$LOGNAME" >/dev/null 2>&1
132 [ -w "/usr/local/home/$LOGNAME" ] \
133 && export LOCAL_HOME="/usr/local/home/$LOGNAME" \
134 || export LOCAL_HOME="$HOME"
136 # Source "~/.profile.user-1st", when available
137 [ -r ~/.profile.user-1st ] && . ~/.profile.user-1st
139 # Setup environment to use local storage (no NFS, if possible!)
140 export XDG_CACHE_HOME="$LOCAL_HOME/.cache"
142 # Setup environment for ccache, if installed
143 type -t ccache >/dev/null && export CCACHE_DIR="$XDG_CACHE_HOME/ccache"
145 # Setup environment for Python "pip", if installed
146 if [ "$(type -t pip 2>/dev/null)" ]; then
147 export PIP_REQUIRE_VIRTUALENV=true
148 export PIP_DOWNLOAD_CACHE="$XDG_CACHE_HOME/pip"
151 # Move Xauthority file to local storage, so that sudo et all work
152 if [ -z "$XAUTHORITY" -a -r ~/.Xauthority ]; then
153 cp ~/.Xauthority /tmp/Xauthority-$LOGNAME
154 chmod 600 /tmp/Xauthority-$LOGNAME
155 export XAUTHORITY="/tmp/Xauthority-$LOGNAME"
158 # read profile additions
159 if [ -d /etc/profile.d -o -d /usr/local/etc/profile.d ]; then
162 /usr/local/etc/profile.d/*
164 [ -r "$f" ] || continue
169 [ -e ~/.ConfigScripts.debug ] \
177 # read local profile, if available
178 [ -r "/var/lib/${HOSTNAME}/profile" ] && . /var/lib/${HOSTNAME}/profile
186 # Use "xterm-256color" for xterm's (and the like) when it is available
187 [ "$TERM" = "xterm" -a -r "/usr/share/terminfo/x/xterm+256color" ] \
188 && export TERM="xterm-256color"
190 # validate terminal definition
191 type -t tset >/dev/null && eval `tset -s -Q`
193 # generic shell prompt
194 [ "$LOGNAME" = "root" ] \
195 && PS1="<$HOSTNAME> # " \
196 || PS1="<$HOSTNAME> \$ "
198 # Reminders (once every 60 minutes)
199 if [ -z `find ~/.last_reminder -mmin -60 2>/dev/null` ]; then
200 [ -e ~/.ConfigScripts.debug ] && echo " - Reminders ..."
201 if [ "$(type -t icalBuddy 2>/dev/null)" -a "$LOGNAME" != "root" ]; then
204 *.UTF*) bul="•"; bul_imp="!"; sep="»"; ;;
205 *) bul="*"; bul_imp="!"; sep=">"; ;;
207 icalBuddy -f -n -b " $bul " -ab " $bul_imp " -ps "/ $sep /" \
208 -nc -npn -iep "title,due" -stda \
209 tasksDueBefore:today 2>/dev/null
210 icalBuddy -f -n -b " $bul " -ab " $bul_imp " -ps "/ $sep /" \
211 -nc -npn -iep "title,datetime" \
212 eventsToday+1 2>/dev/null
214 unset bul bul_imp sep
217 if [ "$(type -t remind 2>/dev/null)" -a -r ~/.remind ]; then
218 remind -h -g -t5 ~/.remind | \
219 grep -v '^Reminders for ' | grep -v '^$'
223 [ -w ~/ ] && touch ~/.last_reminder
226 # bash-specific initialization
227 [ "$BASH" -a -z "$BASHRCREAD" -a -r /etc/bash.bashrc ] \
228 && source /etc/bash.bashrc
229 [ "$BASH" -a -z "$BASHRCREAD" -a -r /etc/bashrc ] \
230 && source /etc/bashrc
232 # ksh-specific initialization
233 [ "$KSH_VERSION" -a -z "$KSHRCREAD" -a -r /etc/ksh.kshrc ] \
236 # Check filesystem quotas
237 mount 2>/dev/null | grep quota >/dev/null 2>&1
238 if [ $? -eq 0 ]; then
239 type -t quota >/dev/null && quota -q