You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
75 lines
2.0 KiB
75 lines
2.0 KiB
# 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" |
|
} |
|
|
|
export -f pathremove pathprepend pathappend |
|
|
|
# Set the initial path |
|
export PATH=/usr/bin |
|
|
|
# Attempt to provide backward compatibility with LFS earlier than 11 |
|
if [ ! -L /bin ]; then |
|
pathappend /bin |
|
fi |
|
|
|
if [ $EUID -eq 0 ] ; then |
|
pathappend /usr/sbin |
|
if [ ! -L /sbin ]; then |
|
pathappend /sbin |
|
fi |
|
unset HISTFILE |
|
fi |
|
|
|
# Set up some environment variables. |
|
export HISTSIZE=1000 |
|
export HISTIGNORE="&:[bf]g:exit" |
|
|
|
# Set some defaults for graphical systems |
|
export XDG_DATA_DIRS=${XDG_DATA_DIRS:-/usr/share} |
|
export XDG_CONFIG_DIRS=${XDG_CONFIG_DIRS:-/etc/xdg} |
|
export XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR:-/tmp/xdg-$USER} |
|
|
|
for script in /etc/profile.d/*.sh ; do |
|
if [ -r $script ] ; then |
|
. $script |
|
fi |
|
done |
|
|
|
unset script |
|
|
|
# End /etc/profile |