This commit is contained in:
Jakobus Schürz 2020-11-12 18:34:22 +01:00
commit 46efcd962a
4 changed files with 16 additions and 14 deletions

View file

@ -53,11 +53,14 @@ esac
# Check for updates in submodules only if last check was INTERVALL hours in the past # Check for updates in submodules only if last check was INTERVALL hours in the past
updated=$(cat ${MYSHELLCONFIG_BASE%/}${MYSHELLCONFIG_BASE:+/}.last_update_submodules 2>/dev/null || echo 0 ) updated=$(cat ${MYSHELLCONFIG_BASE%/}${MYSHELLCONFIG_BASE:+/}.last_update_submodules 2>/dev/null || echo 0 )
if [ $updated -lt $(date --date="${MYSHELLCONFIG_GIT_SUBMODULES_UPDATE_INTERVALL} hours ago" "+%s") ]; then logtrace "dosubmodupdate before: $dosubmodupdate"
dosubmodupdate="true" if [ $updated -lt $(date --date="${MYSHELLCONFIG_GIT_SUBMODULES_UPDATE_INTERVALL} hours ago" "+%s") -a ${MYSHELLCONFIG_GIT_SUBMODULES_UPDATE-${MYSHELLCONFIG_GIT_SUBMODULES_UPDATE_DEFAULT-true}} ]; then
[ -z "${dosubmodupdate+x}" ] && dosubmodupdate="true"
fi fi
logtrace "dosubmodupdate after: $dosubmodupdate"
#echo $SGIT fetch ${MYSHELLCONFIG_GIT_REMOTE_NAME} -p 1>&2 #echo $SGIT fetch ${MYSHELLCONFIG_GIT_REMOTE_NAME} -p 1>&2
loginfo "fetch repo${dosubmodupdate:+ and submodules}"
$SGIT fetch ${dosubmodupdate:+--recurse-submodules} ${MYSHELLCONFIG_GIT_REMOTE_NAME} -p 2>>"${MYSHELLCONFIG_LOGFILE}"|| { logwarn fetch failed; gitupdateend; exit 1; } $SGIT fetch ${dosubmodupdate:+--recurse-submodules} ${MYSHELLCONFIG_GIT_REMOTE_NAME} -p 2>>"${MYSHELLCONFIG_LOGFILE}"|| { logwarn fetch failed; gitupdateend; exit 1; }
if ${dosubmodupdate:-false}; then if ${dosubmodupdate:-false}; then
date "+%s" > ${MYSHELLCONFIG_BASE%/}${MYSHELLCONFIG_BASE:+/}.last_update_submodules date "+%s" > ${MYSHELLCONFIG_BASE%/}${MYSHELLCONFIG_BASE:+/}.last_update_submodules
@ -95,21 +98,20 @@ EOF
fi fi
logwarn " loginfo "repo${dosubmodupdate:+ and submodules} synced"
repo synced"
if ${MYSHELLCONFIG_GIT_SUBMODULES_UPDATE-${MYSHELLCONFIG_GIT_SUBMODULES_UPDATE_DEFAULT-true}}; then #if ${MYSHELLCONFIG_GIT_SUBMODULES_UPDATE-${MYSHELLCONFIG_GIT_SUBMODULES_UPDATE_DEFAULT-true}}; then
if ${dosubmodupdate:-false}; then if ${dosubmodupdate:-false}; then
loginfo "update and commit submodules"
logdebug "$($SGIT submodule update --remote)" logdebug "$($SGIT submodule update --remote)"
logdebug "$($SGIT commit -a -m 'update submodules')" logdebug "$($SGIT commit -a -m 'update submodules')"
date "+%s" > ${MYSHELLCONFIG_BASE%/}${MYSHELLCONFIG_BASE:+/}.last_update_submodules date "+%s" > ${MYSHELLCONFIG_BASE%/}${MYSHELLCONFIG_BASE:+/}.last_update_submodules
logwarn " logwarn "submodules synced"
submodules synced"
fi fi
else #else
loginfo -n ", submodules not synced" # loginfo -n ", submodules not synced"
logdebug "Do not update submodules. It's denied by environment MYSHELLCONFIG_GIT_UPDATE_SUBMODULES: ${MYSHELLCONFIG_GIT_SUBMODULES_UPDATE-${MYSHELLCONFIG_GIT_SUBMODULES_UPDATE_DEFAULT-true}}" # logdebug "Do not update submodules. It's denied by environment MYSHELLCONFIG_GIT_UPDATE_SUBMODULES: ${MYSHELLCONFIG_GIT_SUBMODULES_UPDATE-${MYSHELLCONFIG_GIT_SUBMODULES_UPDATE_DEFAULT-true}}"
fi #fi
EXIT EXIT
exit $rc exit $rc

@ -1 +1 @@
Subproject commit 7c59902f64dcd7ea356e891274b21144d1ea5948 Subproject commit 1b1b8098419daacb92ca401ad6ee0ca6894a40ca

@ -1 +1 @@
Subproject commit d099941360e061587bf7d42cd029c91650ef5a44 Subproject commit 722d66e85abde02518214edd1ab186d321c0170c

@ -1 +1 @@
Subproject commit 5f2421fa3952311df652d9e2994774e6b0d9c7cd Subproject commit 731bdb11d2f57365e02bdb8adaeb59a8b93db27d