From 64fecf16fb635451328f3b63ab53254fabfaab09 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 19 Apr 2023 21:15:33 +0000 Subject: [PATCH 1/3] make profile path configurable as autodetection is too unprecise so far --- profile.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/profile.sh b/profile.sh index 914bafc..fa1baf2 100644 --- a/profile.sh +++ b/profile.sh @@ -80,7 +80,11 @@ 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..." MYPATH=$(pwd) From 0d7c7e9ab7d698f51ff2c4b2d075ff89e3501967 Mon Sep 17 00:00:00 2001 From: fatalerrors Date: Fri, 8 Sep 2023 20:24:03 +0200 Subject: [PATCH 2/3] minor correction --- profile.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/profile.sh b/profile.sh index fa1baf2..bbfa5e7 100644 --- a/profile.sh +++ b/profile.sh @@ -35,7 +35,7 @@ # * OF SUCH DAMAGE. # ------------------------------------------------------------------------------ -if [[ ! $(echo $SHELL | grep bash) ]]; then +if [[ ! $(echo $SHELL | grep -e 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 @@ -129,14 +129,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 From 18f1bc15437f5eb0b687d5db776f737a2d59ae2c Mon Sep 17 00:00:00 2001 From: Geoffray Levasseur Date: Fri, 6 Oct 2023 11:22:10 +0200 Subject: [PATCH 3/3] fix bash/zsh test, some cosmetics --- profile.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/profile.sh b/profile.sh index bbfa5e7..72bbf4a 100644 --- a/profile.sh +++ b/profile.sh @@ -35,7 +35,7 @@ # * OF SUCH DAMAGE. # ------------------------------------------------------------------------------ -if [[ ! $(echo $SHELL | grep -e bash|zsh) ]]; 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 @@ -86,7 +86,7 @@ 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." @@ -106,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"