profile (877B)
1 # Append "$1" to $PATH when not already in. 2 # Copied from Arch Linux, see #12803 for details. 3 append_path () { 4 case ":$PATH:" in 5 *:"$1":*) 6 ;; 7 *) 8 PATH="${PATH:+$PATH:}$1" 9 ;; 10 esac 11 } 12 13 append_path "/usr/local/sbin" 14 append_path "/usr/local/bin" 15 append_path "/usr/sbin" 16 append_path "/usr/bin" 17 append_path "/sbin" 18 append_path "/bin" 19 unset -f append_path 20 21 export PATH 22 export PAGER=less 23 umask 022 24 25 # set up fallback default PS1 26 : "${HOSTNAME:=$(hostname)}" 27 PS1='${HOSTNAME%%.*}:$PWD' 28 [ "$(id -u)" = "0" ] && PS1="${PS1}# " 29 [ "$(id -u)" = "0" ] || PS1="${PS1}\$ " 30 31 # use nicer PS1 for bash and busybox ash 32 [ -n "$BASH_VERSION" -o "$BB_ASH_VERSION" ] && PS1='\h:\w\$ ' 33 34 # use nicer PS1 for zsh 35 [ -n "$ZSH_VERSION" ] && PS1='%m:%~%# ' 36 37 # export PS1 as before 38 export PS1 39 40 for script in /etc/profile.d/*.sh ; do 41 if [ -r "$script" ] ; then 42 . "$script" 43 fi 44 done 45 unset script