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