3 Commits

Author SHA1 Message Date
Geoffray Levasseur
18f1bc1543 fix bash/zsh test, some cosmetics 2023-10-06 11:22:10 +02:00
fatalerrors
0d7c7e9ab7 minor correction 2023-09-08 20:25:04 +02:00
root
64fecf16fb make profile path configurable as autodetection is too unprecise so far 2023-04-19 21:15:33 +00:00

View File

@@ -35,7 +35,7 @@
# * OF SUCH DAMAGE.
# ------------------------------------------------------------------------------
if [[ ! $(echo $SHELL | grep bash) ]]; then
if [[ ! $SHELL =~ bash|zsh ]]; then
echo "That environmet script is designed to be used with bash or zsh being the shell."
echo "Please consider using bash or zsh instead, or patch me ;)!"
return 1
@@ -80,9 +80,13 @@ pathappend ()
# ------------------------------------------------------------------------------
# Store script's path (realpath -s resolve symlinks if profile.sh is a symlink)
export MYPATH=$(dirname $(realpath -s $0))
if [[ -z $PROFILE_PATH ]]; then
export MYPATH=$(dirname $(realpath -s $0))
else
export MYPATH=$PROFILE_PATH
fi
if [[ ! -e $MYPATH/profile.sh ]]; then
echo "[ Warning ] Path detection failed, using pwd..."
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."
@@ -102,6 +106,10 @@ fi
[[ -d ~/bin ]] && pathappend ~/bin
[[ -d ~/.local/bin ]] && pathappend ~/.local/bin
# ------------------------------------------------------------------------------
# Default values are set here and will be overloaded with config file if any
# ------------------------------------------------------------------------------
# Set bash history
export HISTSIZE=50000
export HISTIGNORE="&:[bf]g:exit"
@@ -125,14 +133,14 @@ export DEFAULT_CITY="Toulouse"
# ------------------------------------------------------------------------------
# Load global configuration
[[ -f $MYPATH/etc/profile.conf ]] && . ~/.profile.conf
[[ -f $MYPATH/etc/profile.conf ]] && . $MYPATH/etc/profile.conf
# Load personal configuration
[[ -f ~/.profile.conf ]] && . ~/.profile.conf
# Load module scripts
for script in $MYPATH/profile.d/*.sh ; do
if [ -r $script ] ; then
if [[ -r $script ]]; then
. $script
fi
done