]>
Commit | Line | Data |
---|---|---|
b21b0df6 | 1 | # /etc/profile |
71e32384 | 2 | |
b21b0df6 MT |
3 | # System wide environment and startup programs, for login setup |
4 | # Functions and aliases go in /etc/bashrc | |
cd1a2927 | 5 | |
b21b0df6 MT |
6 | # It's NOT a good idea to change this file unless you know what you |
7 | # are doing. It's much better to create a custom.sh shell script in | |
8 | # /etc/profile.d/ to make custom changes to your environment, as this | |
9 | # will prevent the need for merging in future updates. | |
cd1a2927 | 10 | |
b21b0df6 MT |
11 | pathmunge () { |
12 | case ":${PATH}:" in | |
13 | *:"$1":*) | |
14 | ;; | |
15 | *) | |
16 | if [ "$2" = "after" ] ; then | |
17 | PATH=$PATH:$1 | |
18 | else | |
19 | PATH=$1:$PATH | |
20 | fi | |
21 | esac | |
71e32384 | 22 | } |
cd1a2927 | 23 | |
cd1a2927 | 24 | |
b21b0df6 MT |
25 | if [ -x /usr/bin/id ]; then |
26 | if [ -z "$EUID" ]; then | |
27 | # ksh workaround | |
28 | EUID=`id -u` | |
29 | UID=`id -ru` | |
30 | fi | |
31 | USER="`id -un`" | |
32 | LOGNAME=$USER | |
33 | MAIL="/var/spool/mail/$USER" | |
34 | fi | |
71e32384 | 35 | |
b21b0df6 MT |
36 | # Path manipulation |
37 | if [ "$EUID" = "0" ]; then | |
3f350057 | 38 | pathmunge /sbin |
b21b0df6 MT |
39 | pathmunge /usr/sbin |
40 | pathmunge /usr/local/sbin | |
41 | else | |
42 | pathmunge /usr/local/sbin after | |
43 | pathmunge /usr/sbin after | |
3f350057 | 44 | pathmunge /sbin after |
b21b0df6 | 45 | fi |
71e32384 | 46 | |
7a644832 | 47 | HOSTNAME=`/bin/hostname 2>/dev/null` |
b21b0df6 MT |
48 | HISTSIZE=1000 |
49 | if [ "$HISTCONTROL" = "ignorespace" ] ; then | |
50 | export HISTCONTROL=ignoreboth | |
51 | else | |
52 | export HISTCONTROL=ignoredups | |
cd1a2927 MT |
53 | fi |
54 | ||
b21b0df6 MT |
55 | export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL |
56 | ||
57 | # By default, we want umask to get set. This sets it for login shell | |
58 | # Current threshold for system reserved uid/gids is 200 | |
59 | # You could check uidgid reservation validity in | |
60 | # /usr/share/doc/setup-*/uidgid file | |
61 | if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then | |
62 | umask 002 | |
63 | else | |
64 | umask 022 | |
65 | fi | |
cd1a2927 | 66 | |
b21b0df6 MT |
67 | for i in /etc/profile.d/*.sh ; do |
68 | if [ -r "$i" ]; then | |
69 | if [ "${-#*i}" != "$-" ]; then | |
70 | . "$i" | |
71 | else | |
72 | . "$i" >/dev/null 2>&1 | |
71e32384 | 73 | fi |
b21b0df6 | 74 | fi |
71e32384 | 75 | done |
cd1a2927 | 76 | |
b21b0df6 MT |
77 | unset i |
78 | unset pathmunge |