]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - config/etc/profile
Import bash startfiles from IPFire 3.x.
[people/pmueller/ipfire-2.x.git] / config / etc / profile
CommitLineData
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
11pathmunge () {
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
25if [ -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"
34fi
71e32384 35
b21b0df6
MT
36# Path manipulation
37if [ "$EUID" = "0" ]; then
38 pathmunge /usr/sbin
39 pathmunge /usr/local/sbin
40else
41 pathmunge /usr/local/sbin after
42 pathmunge /usr/sbin after
43fi
71e32384 44
b21b0df6
MT
45HOSTNAME=`/usr/bin/hostname 2>/dev/null`
46HISTSIZE=1000
47if [ "$HISTCONTROL" = "ignorespace" ] ; then
48 export HISTCONTROL=ignoreboth
49else
50 export HISTCONTROL=ignoredups
cd1a2927
MT
51fi
52
b21b0df6
MT
53export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL
54
55# By default, we want umask to get set. This sets it for login shell
56# Current threshold for system reserved uid/gids is 200
57# You could check uidgid reservation validity in
58# /usr/share/doc/setup-*/uidgid file
59if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then
60 umask 002
61else
62 umask 022
63fi
cd1a2927 64
b21b0df6
MT
65for i in /etc/profile.d/*.sh ; do
66 if [ -r "$i" ]; then
67 if [ "${-#*i}" != "$-" ]; then
68 . "$i"
69 else
70 . "$i" >/dev/null 2>&1
71e32384 71 fi
b21b0df6 72 fi
71e32384 73done
cd1a2927 74
b21b0df6
MT
75unset i
76unset pathmunge