bugfix, esthetic cleanup, better comments, version bump
This commit is contained in:
17
profile.sh
17
profile.sh
@@ -44,35 +44,34 @@ fi
|
||||
# ------------------------------------------------------------------------------
|
||||
# path* : private functions for PATH variable management
|
||||
# ------------------------------------------------------------------------------
|
||||
pathremove ()
|
||||
pathremove()
|
||||
{
|
||||
local ifs=':'
|
||||
local newpath
|
||||
local dir
|
||||
local pathvar=${2:-PATH}
|
||||
for dir in ${!pathvar} ; do
|
||||
if [ "$dir" != "$1" ] ; then
|
||||
for dir in ${!pathvar}; do
|
||||
if [ "$dir" != "$1" ]; then
|
||||
newpath=${newpath:+$newpath:}$dir
|
||||
fi
|
||||
done
|
||||
export $pathvar="$newpath"
|
||||
}
|
||||
|
||||
pathprepend ()
|
||||
pathprepend()
|
||||
{
|
||||
pathremove $1 $2
|
||||
local pathvar=${2:-PATH}
|
||||
export $pathvar="$1${!pathvar:+:${!pathvar}}"
|
||||
}
|
||||
|
||||
pathappend ()
|
||||
pathappend()
|
||||
{
|
||||
pathremove $1 $2
|
||||
local pathvar=${2:-PATH}
|
||||
export $pathvar="${!pathvar:+${!pathvar}:}$1"
|
||||
}
|
||||
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# ------------------------------------------------------------------------------
|
||||
# ********************************** MAIN PROGRAM ******************************
|
||||
@@ -89,7 +88,7 @@ if [[ ! -e $MYPATH/profile.sh ]]; then
|
||||
echo "[ Warning ] Path detection failed, trying to use pwd..."
|
||||
MYPATH=$(pwd)
|
||||
if [[ ! -e $MYPATH/profile.sh ]]; then
|
||||
echo "[ Error ] Impossible to determine installation path, pretty much nothing will work."
|
||||
echo "[ Error ] Impossible to determine installation path, pretty much nothing will work."
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -99,7 +98,7 @@ fi
|
||||
export PROFVERSION=$(cat $MYPATH/version)
|
||||
|
||||
# Build PATH environment variable
|
||||
if [[ $EUID -eq 0 ]] ; then
|
||||
if [[ $EUID -eq 0 ]]; then
|
||||
pathappend /sbin:/usr/sbin
|
||||
fi
|
||||
[[ -d /share/services/gestparc ]] && pathappend /share/services/gestparc
|
||||
@@ -139,7 +138,7 @@ export DEFAULT_CITY="Toulouse"
|
||||
[[ -f ~/.profile.conf ]] && . ~/.profile.conf
|
||||
|
||||
# Load module scripts
|
||||
for script in $MYPATH/profile.d/*.sh ; do
|
||||
for script in $MYPATH/profile.d/*.sh; do
|
||||
if [[ -r $script ]]; then
|
||||
. $script
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user