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