diff options
author | Prajwal Mohan <prajwal.karur.mohan@intel.com> | 2012-06-14 15:30:48 -0700 |
---|---|---|
committer | Prajwal Mohan <prajwal.karur.mohan@intel.com> | 2012-06-14 15:30:48 -0700 |
commit | 6855d0029f9c32e38c0d135456ac500b03cec761 (patch) | |
tree | 9e2a8d13fbee4a5d44d71d5108d564aa9ea5a4a9 /profile | |
parent | e55b918127994d503f6c7af393a6150b87b14dd9 (diff) | |
download | setup-6855d0029f9c32e38c0d135456ac500b03cec761.tar.gz setup-6855d0029f9c32e38c0d135456ac500b03cec761.tar.bz2 setup-6855d0029f9c32e38c0d135456ac500b03cec761.zip |
Upgrade to v0.4
Diffstat (limited to 'profile')
-rw-r--r-- | profile | 58 |
1 files changed, 54 insertions, 4 deletions
@@ -1,15 +1,65 @@ # /etc/profile -# System wide environment and startup programs +# System wide environment and startup programs, for login setup # Functions and aliases go in /etc/bashrc -HOSTNAME=`/bin/hostname` +# It's NOT good idea to change this file unless you know what you +# are doing. Much better way is to create custom.sh shell script in +# /etc/profile.d/ to make custom changes to environment. This will +# prevent need for merging in future updates. + +pathmunge () { + if ! echo $PATH | /bin/grep -qE "(^|:)$1($|:)" ; then + if [ "$2" = "after" ] ; then + PATH=$PATH:$1 + else + PATH=$1:$PATH + fi + fi +} + + +if [ -x /usr/bin/id ]; then + if [ -z "$EUID" ]; then + # ksh workaround + EUID=`id -u` + UID=`id -ru` + fi + USER="`id -un`" + LOGNAME=$USER + MAIL="/var/spool/mail/$USER" +fi + +# Path manipulation +if [ "$EUID" = "0" ]; then + pathmunge /sbin + pathmunge /usr/sbin + pathmunge /usr/local/sbin +else + pathmunge /usr/local/sbin after + pathmunge /usr/sbin after + pathmunge /sbin after +fi + +HOSTNAME=`/bin/hostname 2>/dev/null` HISTSIZE=1000 +if [ "$HISTCONTROL" = "ignorespace" ] ; then + export HISTCONTROL=ignoreboth +else + export HISTCONTROL=ignoredups +fi -export PATH HOSTNAME HISTSIZE +export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL for i in /etc/profile.d/*.sh ; do if [ -r "$i" ]; then - . $i + if [ "$PS1" ]; then + . $i + else + . $i >/dev/null 2>&1 + fi fi done + +unset i +unset pathmunge |