diff options
author | Thierry N <thierryn1 at hispeed dot ch> | 2009-08-07 13:26:37 +0200 |
---|---|---|
committer | Thierry N <thierryn1 at hispeed dot ch> | 2009-08-07 13:26:37 +0200 |
commit | 31cae2538311f58c8bba5441313d041436f11ce6 (patch) | |
tree | cc1fef0aaed8a6affc57b8abff2f8cf7690bb6c1 /base/aaabasicfs/profile | |
download | nutyx-extra-31cae2538311f58c8bba5441313d041436f11ce6.tar.gz nutyx-extra-31cae2538311f58c8bba5441313d041436f11ce6.tar.bz2 nutyx-extra-31cae2538311f58c8bba5441313d041436f11ce6.tar.xz nutyx-extra-31cae2538311f58c8bba5441313d041436f11ce6.zip |
Ajout de aaabasicfs#2009-1
Diffstat (limited to 'base/aaabasicfs/profile')
-rw-r--r-- | base/aaabasicfs/profile | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/base/aaabasicfs/profile b/base/aaabasicfs/profile new file mode 100644 index 000000000..96b7d6deb --- /dev/null +++ b/base/aaabasicfs/profile @@ -0,0 +1,72 @@ +# Begin /etc/profile +# Written for Beyond Linux From Scratch +# by James Robertson <jameswrobertson@earthlink.net> +# modifications by Dagmar d'Surreal <rivyqntzne@pbzpnfg.arg> + +# System wide environment variables and startup programs. + +# System wide aliases and functions should go in /etc/bashrc. Personal +# environment variables and startup programs should go into +# ~/.bash_profile. Personal aliases and functions should go into +# ~/.bashrc. + +# Functions to help us manage paths. Second argument is the name of the +# path variable to be modified (default: PATH) +pathremove () { + local IFS=':' + local NEWPATH + local DIR + local PATHVARIABLE=${2:-PATH} + for DIR in ${!PATHVARIABLE} ; do + if [ "$DIR" != "$1" ] ; then + NEWPATH=${NEWPATH:+$NEWPATH:}$DIR + fi + done + export $PATHVARIABLE="$NEWPATH" +} + +pathprepend () { + pathremove $1 $2 + local PATHVARIABLE=${2:-PATH} + export $PATHVARIABLE="$1${!PATHVARIABLE:+:${!PATHVARIABLE}}" +} + +pathappend () { + pathremove $1 $2 + local PATHVARIABLE=${2:-PATH} + export $PATHVARIABLE="${!PATHVARIABLE:+${!PATHVARIABLE}:}$1" +} + + +# Set the initial path +export PATH=/bin:/usr/bin + +if [ $EUID -eq 0 ] ; then + pathappend /sbin:/usr/sbin + unset HISTFILE +fi + +# Setup some environment variables. +export HISTSIZE=1000 +export HISTIGNORE="&:[bf]g:exit" + +# Setup a red prompt for root and a green one for users. +NORMAL="\[\e[0m\]" +RED="\[\e[1;31m\]" +GREEN="\[\e[1;32m\]" +if [[ $EUID == 0 ]] ; then + PS1="$RED\u [ $NORMAL\w$RED ]# $NORMAL" +else + PS1="$GREEN\u [ $NORMAL\w$GREEN ]\$ $NORMAL" +fi + +for script in /etc/profile.d/*.sh ; do + if [ -r $script ] ; then + . $script + fi +done + +# Now to clean up +unset pathremove pathprepend pathappend + +# End /etc/profile |