]> git.ipfire.org Git - people/amarx/ipfire-3.x.git/blame - setup/bashrc
util-linux: Conflicts sysvinit <= 2.86-6.
[people/amarx/ipfire-3.x.git] / setup / bashrc
CommitLineData
03bb3da9
MT
1# /etc/bashrc
2
3# System wide functions and aliases
4# Environment stuff goes in /etc/profile
5
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.
10
11# are we an interactive shell?
12if [ "$PS1" ]; then
9233291e 13 if [ -z "$PROMPT_COMMAND" ]; then
03bb3da9
MT
14 case $TERM in
15 xterm*)
9233291e
MT
16 if [ -e /etc/sysconfig/bash-prompt-xterm ]; then
17 PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm
18 else
19 PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
20 fi
21 ;;
03bb3da9 22 screen)
9233291e
MT
23 if [ -e /etc/sysconfig/bash-prompt-screen ]; then
24 PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen
25 else
26 PROMPT_COMMAND='printf "\033]0;%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
27 fi
28 ;;
03bb3da9 29 *)
9233291e
MT
30 [ -e /etc/sysconfig/bash-prompt-default ] && PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default
31 ;;
03bb3da9 32 esac
9233291e
MT
33 fi
34 # Turn on parallel history
35 shopt -s histappend
36 history -a
37 # Turn on checkwinsize
38 shopt -s checkwinsize
39 [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "
40 # You might want to have e.g. tty in prompt (e.g. more virtual machines)
41 # and console windows
42 # If you want to do so, just add e.g.
43 # if [ "$PS1" ]; then
44 # PS1="[\u@\h:\l \W]\\$ "
45 # fi
46 # to your custom modification shell script in /etc/profile.d/ directory
03bb3da9
MT
47fi
48
49if ! shopt -q login_shell ; then # We're not a login shell
50 # Need to redefine pathmunge, it get's undefined at the end of /etc/profile
51 pathmunge () {
52 case ":${PATH}:" in
53 *:"$1":*)
54 ;;
55 *)
56 if [ "$2" = "after" ] ; then
57 PATH=$PATH:$1
58 else
59 PATH=$1:$PATH
60 fi
61 esac
62 }
63
64 # By default, we want umask to get set. This sets it for non-login shell.
65 # Current threshold for system reserved uid/gids is 200
66 # You could check uidgid reservation validity in
67 # /usr/share/doc/setup-*/uidgid file
68 if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then
69 umask 002
70 else
71 umask 022
72 fi
73
74 # Only display echos from profile.d scripts if we are no login shell
75 # and interactive - otherwise just process them to set envvars
76 for i in /etc/profile.d/*.sh; do
77 if [ -r "$i" ]; then
78 if [ "$PS1" ]; then
79 . "$i"
80 else
9233291e 81 . "$i" >/dev/null
03bb3da9
MT
82 fi
83 fi
84 done
85
86 unset i
9233291e 87 unset -f pathmunge
03bb3da9
MT
88fi
89# vim:ts=4:sw=4