]> git.ipfire.org Git - ipfire-3.x.git/blob - setup/bashrc
setup: Port sysctl hardening settings from IPFire 2.x
[ipfire-3.x.git] / setup / bashrc
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 # Prevent doublesourcing
12 if [ -z "$BASHRCSOURCED" ]; then
13 BASHRCSOURCED="Y"
14
15 # are we an interactive shell?
16 if [ "$PS1" ]; then
17 if [ -z "$PROMPT_COMMAND" ]; then
18 case $TERM in
19 xterm*)
20 if [ -e /etc/sysconfig/bash-prompt-xterm ]; then
21 PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm
22 else
23 PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"'
24 fi
25 ;;
26 screen*)
27 if [ -e /etc/sysconfig/bash-prompt-screen ]; then
28 PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen
29 else
30 PROMPT_COMMAND='printf "\033k%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"'
31 fi
32 ;;
33 *)
34 [ -e /etc/sysconfig/bash-prompt-default ] && PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default
35 ;;
36 esac
37 fi
38 # Turn on parallel history
39 shopt -s histappend
40 # Turn on checkwinsize
41 shopt -s checkwinsize
42 [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "
43 # You might want to have e.g. tty in prompt (e.g. more virtual machines)
44 # and console windows
45 # If you want to do so, just add e.g.
46 # if [ "$PS1" ]; then
47 # PS1="[\u@\h:\l \W]\\$ "
48 # fi
49 # to your custom modification shell script in /etc/profile.d/ directory
50 fi
51
52 if ! shopt -q login_shell ; then # We're not a login shell
53 # Need to redefine pathmunge, it gets undefined at the end of /etc/profile
54 pathmunge () {
55 case ":${PATH}:" in
56 *:"$1":*)
57 ;;
58 *)
59 if [ "$2" = "after" ] ; then
60 PATH=$PATH:$1
61 else
62 PATH=$1:$PATH
63 fi
64 esac
65 }
66
67 # Set default umask for non-login shell only if it is set to 0
68 [ `umask` -eq 0 ] && umask 022
69
70 SHELL=/bin/bash
71 # Only display echos from profile.d scripts if we are no login shell
72 # and interactive - otherwise just process them to set envvars
73 for i in /etc/profile.d/*.sh; do
74 if [ -r "$i" ]; then
75 if [ "$PS1" ]; then
76 . "$i"
77 else
78 . "$i" >/dev/null
79 fi
80 fi
81 done
82
83 unset i
84 unset -f pathmunge
85 fi
86
87 fi
88 # vim:ts=4:sw=4