update submodules only in intervall not every init
MYSHELLCONFIG_GIT_SUBMODULES_INTERVALL=<time in hours>
This commit is contained in:
parent
235008768f
commit
4151446013
2 changed files with 35 additions and 28 deletions
|
@ -40,6 +40,7 @@ if [[ $- = *i* ]] ; then
|
|||
[ -z "${MYSHELLCONFIG_GIT_CHECKOUT_TIMEOUT+x}" ] && export MYSHELLCONFIG_GIT_CHECKOUT_TIMEOUT=20s
|
||||
[ -z "${MYSHELLCONFIG_GIT_SYNC+x}" ] && export MYSHELLCONFIG_GIT_SYNC=true
|
||||
[ -z "${MYSHELLCONFIG_GIT_SUBMODULES_UPDATE_DEFAULT+x}" ] && export MYSHELLCONFIG_GIT_SUBMODULES_UPDATE_DEFAULT=true
|
||||
[ -z "${MYSHELLCONFIG_GIT_SUBMODULES_UPDATE_INTERVALL+x}" ] && export MYSHELLCONFIG_GIT_SUBMODULES_UPDATE_INTERVALL=2 #intervall in hours
|
||||
[ -z "${MYSHELLCONFIG_GIT_SUBMODULES_SERVER_DEFAULT+x}" ] && export MYSHELLCONFIG_GIT_SUBMODULES_SERVER_DEFAULT="git://git.schuerz.at/github.com/"
|
||||
# hardcoded git
|
||||
export SGIT="git -C ${MYSHELLCONFIG_BASE}"
|
||||
|
|
|
@ -84,6 +84,8 @@ fi
|
|||
loginfo -n "repo synced"
|
||||
|
||||
if ${MYSHELLCONFIG_GIT_SUBMODULES_UPDATE-${MYSHELLCONFIG_GIT_SUBMODULES_UPDATE_DEFAULT-true}}; then
|
||||
updated=$(cat ${MYSHELLCONFIG_BASE%/}${MYSHELLCONFIG_BASE:+/}.last_udate_submodules 2>/dev/null || echo 0 )
|
||||
if [ $updated -lt $(date --date="${MYSHELLCONFIG_GIT_SUBMODULES_UPDATE_INTERVALL} hours ago" "+%s") ]; then
|
||||
logdebug "update submodules"
|
||||
rc=0
|
||||
# srv="${MYSHELLCONFIG_GIT_SUBMODULES_SERVER-${MYSHELLCONFIG_GIT_SUBMODULES_SERVER_DEFAULT}}"
|
||||
|
@ -113,6 +115,10 @@ if ${MYSHELLCONFIG_GIT_SUBMODULES_UPDATE-${MYSHELLCONFIG_GIT_SUBMODULES_UPDATE_D
|
|||
#$SGIT checkout .gitmodules
|
||||
logdebug "submodules updated successfully"
|
||||
loginfo -n ", submodules synced"
|
||||
date "+%s" > ${MYSHELLCONFIG_BASE%/}${MYSHELLCONFIG_BASE:+/}.last_udate_submodules
|
||||
else
|
||||
logdebug "submodules not updated. last update is less then ${MYSHELLCONFIG_GIT_SUBMODULE_UPDATE_INTERVALL} hours ago"
|
||||
fi
|
||||
|
||||
else
|
||||
loginfo -n ", submodules not synced"
|
||||
|
|
Loading…
Reference in a new issue