]> arthur.barton.de Git - ConfigScripts.git/blob - sys/profile
Added support for icalBuddy(1)
[ConfigScripts.git] / sys / profile
1 #
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-2009 by Alexander Barton (alex@barton.de)
5 #
6
7 [ -e ~/.ConfigScripts.debug ] && echo " >> /etc/profile ..."
8
9 PROFILEREAD="true"
10 export PROFILEREAD
11
12 # Make sure UID is set
13 [ -n "$UID" ] || UID=`id -u`
14 export UID
15
16 # Set locale if it is not set or doesn't contain a dot;
17 # but all system messages should still be in "native" ("C") language.
18 [ "$LANG" = "${LANG#*.}" -a "$LANG" != "C" ] \
19         && export LANG="${LANG:-de_DE}.ISO8859-1"
20 export LC_MESSAGES="C"
21
22 # Initialize PATH variable
23 if [ -x /usr/libexec/path_helper ]; then
24         eval `/usr/libexec/path_helper -s`
25 else
26         PATH="/usr/local/bin:/usr/bin:/bin"
27         [ "$UID" -eq 0 ] && PATH="/usr/local/sbin:/usr/sbin:/sbin:$PATH"
28         export PATH
29 fi
30 # prepend optional directories to PATH ...
31 path=""
32 for d in /Developer/usr/bin /usr/pkg/bin /opt/*/bin; do
33         [ -d "$d" -o -h "$d" ] && path="$path$d:"
34 done
35 [ -n "$path" ] && PATH="$path$PATH"
36 if [ "$UID" -eq 0 ]; then
37         path=""
38         for d in /usr/pkg/sbin /opt/*/sbin; do
39                 [ -d "$d" -o -h "$d" ] && path="$path$d:"
40         done
41         [ -n "$path" ] && PATH="$path$PATH"
42 fi
43 # append optional directories to PATH ...
44 for d in /usr/bin/X11 /usr/games; do
45         [ -d "$d" -o -h "$d" ] && PATH="$PATH:$d"
46 done
47 # set PATH so it includes user's private executables
48 [ -d ~/Applications ] && PATH=~/Applications:"${PATH}"
49 [ -d ~/bin ] && PATH=~/bin:"${PATH}"
50 [ -d ~/sbin ] && PATH=~/sbin:"${PATH}"
51
52 # Setup MANPATH, if manpath(1) isn't available
53 if [ ! "$(type manpath)" ]; then
54         [ -z "$MANPATH" ] \
55                 && MANPATH="/usr/local/share/man:/usr/share/man:/usr/man"
56         path=""
57         for d in /usr/pkg/share/man /usr/pkg/man /opt/*/share/man /opt/*/man; do
58                 [ -d "$d" -o -h "$d" ] && path="$path$d:"
59         done
60         [ -n "$path" ] && MANPATH="$path$MANPATH"
61         [ -d ~/share/man ] && MANPATH=~/share/man:"${MANPATH}"
62         [ -d ~/man ] && MANPATH=~/man:"${MANPATH}"
63 fi
64
65 # set variable identifying the chroot you work in
66 [ -r /etc/debian_chroot ] && chroot_name=$(cat /etc/debian_chroot)
67 [ -r /etc/chroot_name ] && chroot_name=$(cat /etc/chroot_name)
68
69 # validate terminal definition
70 [ -z "$TERM" ] && eval `tset -s -Q`
71
72 # make sure $UID and $USER is set
73 [ -z "$UID" ] && UID=`id -u`
74 [ -z "$USER" ] && USER=`id -un`
75 export UID USER
76
77 # get my own hostname
78 ME=`hostname -s`
79 export ME
80
81 # Move Xauthority file to local storage, so that sudo et all work
82 if [ -z "$XAUTHORITY" -a -r ~/.Xauthority ]; then
83         cp ~/.Xauthority /tmp/Xauthority-$USER
84         chmod 600 /tmp/Xauthority-$USER
85         export XAUTHORITY="/tmp/Xauthority-$USER"
86 fi
87
88 # read profile additions
89 if [ -d /etc/profile.d ]; then
90         for f in /etc/profile.d/*; do
91                 [ -r "$f" ] || continue
92                 case "$f" in
93                         *.csh)
94                                 ;;
95                         *)
96                                 [ -e ~/.ConfigScripts.debug ] \
97                                         && echo " >> $f ..."
98                                 . "$f"
99                 esac
100         done
101 fi
102
103 # read local profile, if available
104 [ -r "/var/lib/${ME}/profile" ] && . /var/lib/${ME}/profile
105
106 # interactive shell?
107 [ "$PS1" ] || return
108
109 # generic shell prompt
110 [ "$UID" -eq 0 ] \
111         && PS1="<$ME> # " \
112         || PS1="<$ME> \$ "
113
114 # icalBuddy(1)
115 type -p icalBuddy >/dev/null 2>&1
116 if [ $? -eq 0 ]; then
117         icalBuddy -f -n -npn -nc -ps "/ » /" -eep "url,notes" \
118                 eventsToday+1 | grep "•"
119         [ $? -eq 0 ] && echo
120 else
121         # remind(1)
122         type -p remind >/dev/null 2>&1
123         if [ $? -eq 0 -a -r ~/.remind ]; then
124                 remind -h -g -t5 .remind | grep "^[0-9]"
125                 [ $? -eq 0 ] && echo
126         fi
127 fi
128
129 # bash-specific initialization
130 [ "$BASH" -a -z "$BASHRCREAD" -a -r /etc/bash.bashrc ] \
131         && source /etc/bash.bashrc
132 [ "$BASH" -a -z "$BASHRCREAD" -a -r /etc/bashrc ] \
133         && source /etc/bashrc
134
135 # ksh-specific initialization
136 [ "$KSH_VERSION" -a -z "$KSHRCREAD" -a -r /etc/ksh.kshrc ] \
137         && . /etc/ksh.kshrc
138
139 # Check filesystem quotas
140 which quota >/dev/null 2>&1
141 [ $? -eq 0 ] && quota -q
142
143 # -eof-