]> arthur.barton.de Git - ConfigScripts.git/blob - sys/profile
Rewrap script line to 80 characters
[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" ] && . "$f"
87         done
88 fi
89
90 # read local profile, if available
91 [ -r "/var/lib/${ME}/profile" ] && . /var/lib/${ME}/profile
92
93 # interactive shell?
94 [ "$PS1" ] || return
95
96 # generic shell prompt
97 [ "$UID" -eq 0 ] \
98         && PS1="<$ME> # " \
99         || PS1="<$ME> \$ "
100
101 # bash-specific initialization
102 [ "$BASH" -a -z "$BASHRCREAD" -a -r /etc/bash.bashrc ] \
103         && source /etc/bash.bashrc
104 [ "$BASH" -a -z "$BASHRCREAD" -a -r /etc/bashrc ] \
105         && source /etc/bashrc
106
107 # ksh-specific initialization
108 [ "$KSH_VERSION" -a -z "$KSHRCREAD" -a -r /etc/ksh.kshrc ] \
109         && . /etc/ksh.kshrc
110
111 # Check filesystem quotas
112 which quota >/dev/null 2>&1
113 [ $? -eq 0 ] && quota -q
114
115 # -eof-