add option for sync or not sync profile

Variable MYSHELLCONFIG_GIT_SYNC in ~/.bashrc
if unset it defaults to true. So profile is synced
If Set to false, do not sync profile
This commit is contained in:
Jakobus Schürz 2020-02-25 16:15:32 +01:00
parent 8827e99d53
commit 42e20462ca

View file

@ -27,6 +27,7 @@ if [[ $- = *i* ]] ; then
[ -z "${MYSHELLCONFIG_GIT_TIMEOUT+x}" ] && MYSHELLCONFIG_GIT_TIMEOUT=5s [ -z "${MYSHELLCONFIG_GIT_TIMEOUT+x}" ] && MYSHELLCONFIG_GIT_TIMEOUT=5s
[ -z "${MYSHELLCONFIG_GIT_CHECKOUT_TIMEOUT+x}" ] && MYSHELLCONFIG_GIT_CHECKOUT_TIMEOUT=20s [ -z "${MYSHELLCONFIG_GIT_CHECKOUT_TIMEOUT+x}" ] && MYSHELLCONFIG_GIT_CHECKOUT_TIMEOUT=20s
MYSHELLCONFIG_BASH_COMPLETION="${HOME}/${MYSHELLCONFIG_SUBPATH}/bash_completion.d" MYSHELLCONFIG_BASH_COMPLETION="${HOME}/${MYSHELLCONFIG_SUBPATH}/bash_completion.d"
[ -z "${MYSHELLCONFIG_GIT_SYNC+x}" ] && MYSHELLCONFIG_GIT_SYNC=true
SGIT="git -C ${MYSHELLCONFIG_BASE}" SGIT="git -C ${MYSHELLCONFIG_BASE}"
export MYSHELLCONFIG_BASE MYSHELLCONFIG_LOGDIR MYSHELLCONFIG_LOGFILE SGIT MYSHELLCONFIG_VIM_PLUGINS export MYSHELLCONFIG_BASE MYSHELLCONFIG_LOGDIR MYSHELLCONFIG_LOGFILE SGIT MYSHELLCONFIG_VIM_PLUGINS
@ -47,6 +48,7 @@ EOF
} }
sync_config () { sync_config () {
if $MYSHELLCONFIG_GIT_SYNC; then
local nok="" local nok=""
local gco="" local gco=""
if which git >/dev/null; then if which git >/dev/null; then
@ -64,6 +66,9 @@ EOF
else else
echo "git not installed, no configuration possible, please install git" >&2 echo "git not installed, no configuration possible, please install git" >&2
fi fi
else
echo "Not syncing profile in case of configuration"
fi
} }