change output and update-strategy
This commit is contained in:
parent
e88557ca40
commit
f2b968bc92
1 changed files with 18 additions and 11 deletions
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
ENTRY
|
ENTRY
|
||||||
cat << EOF >> "${MYSHELLCONFIG_LOGFILE}"
|
cat << EOF >> "${MYSHELLCONFIG_LOGFILE}"
|
||||||
+-----BEGINN $(date) -------------------------------+
|
+-----BEGINN git update repo $(date) -------------------------------+
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
|
@ -30,6 +30,9 @@ case $1 in
|
||||||
# Headless repo local
|
# Headless repo local
|
||||||
PRE="${MYSHELLCONFIG_GIT_REMOTE_NAME}"
|
PRE="${MYSHELLCONFIG_GIT_REMOTE_NAME}"
|
||||||
;;
|
;;
|
||||||
|
-s)
|
||||||
|
GIT_FETCH_OPTIONS="--recurse-submodules"
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
PRE=""
|
PRE=""
|
||||||
;;
|
;;
|
||||||
|
@ -40,22 +43,27 @@ esac
|
||||||
# Output
|
# Output
|
||||||
#echo -n " remote: ${MYSHELLCONFIG_GIT_REMOTE_NAME}, branch: ${MYSHELLCONFIG_GIT_BRANCH}: "
|
#echo -n " remote: ${MYSHELLCONFIG_GIT_REMOTE_NAME}, branch: ${MYSHELLCONFIG_GIT_BRANCH}: "
|
||||||
|
|
||||||
#echo $SGIT fetch ${MYSHELLCONFIG_GIT_REMOTE_NAME} -p 1>&2
|
# Check for updates in submodules only if last check was INTERVALL hours in the past
|
||||||
$SGIT fetch ${MYSHELLCONFIG_GIT_REMOTE_NAME} -p 2>>"${MYSHELLCONFIG_LOGFILE}"|| { logwarn fetch failed; exit 1; }
|
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
|
||||||
|
GIT_FETCH_OPTIONS="--recurse-submodules"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#echo $SGIT fetch ${MYSHELLCONFIG_GIT_REMOTE_NAME} -p 1>&2
|
||||||
|
$SGIT fetch ${GIT_FETCH_OPTIONS} ${MYSHELLCONFIG_GIT_REMOTE_NAME} -p 2>>"${MYSHELLCONFIG_LOGFILE}"|| { logwarn fetch failed; exit 1; }
|
||||||
|
|
||||||
|
ech "Check for local changes:" >> "${MYSHELLCONFIG_LOGFILE}"
|
||||||
if $SGIT diff-index --ignore-submodules --exit-code HEAD -- >> "${MYSHELLCONFIG_LOGFILE}" ; then
|
if $SGIT diff-index --ignore-submodules --exit-code HEAD -- >> "${MYSHELLCONFIG_LOGFILE}" ; then
|
||||||
cat << EOF >> "${MYSHELLCONFIG_LOGFILE}"
|
cat << EOF >> "${MYSHELLCONFIG_LOGFILE}"
|
||||||
Check for local changes:
|
|
||||||
no changes in local repo
|
no changes in local repo
|
||||||
$SGIT checkout repo ${PRE}${PRE:+/}${MYSHELLCONFIG_GIT_BRANCH}
|
$SGIT checkout repo ${PRE}${PRE:+/}${MYSHELLCONFIG_GIT_BRANCH}
|
||||||
EOF
|
EOF
|
||||||
#echo "checkout origin/master as detached HEAD"
|
|
||||||
$SGIT checkout ${PRE}${PRE:+/}${MYSHELLCONFIG_GIT_BRANCH} 1>>"${MYSHELLCONFIG_LOGFILE}" 2>>"${MYSHELLCONFIG_LOGFILE}"|| exit 2
|
$SGIT checkout ${PRE}${PRE:+/}${MYSHELLCONFIG_GIT_BRANCH} 1>>"${MYSHELLCONFIG_LOGFILE}" 2>>"${MYSHELLCONFIG_LOGFILE}"|| exit 2
|
||||||
$SGIT merge FETCH_HEAD 1>>"${MYSHELLCONFIG_LOGFILE}" 2>>"${MYSHELLCONFIG_LOGFILE}"|| exit 3
|
$SGIT merge FETCH_HEAD 1>>"${MYSHELLCONFIG_LOGFILE}" 2>>"${MYSHELLCONFIG_LOGFILE}"|| exit 3
|
||||||
else
|
else
|
||||||
|
logwarn -n " Lokale Änderungen festgestellt:"
|
||||||
|
echo " Siehe Logfile ${MYSHELLCONFIG_LOGFILE}" >&2
|
||||||
cat << EOF >> "${MYSHELLCONFIG_LOGFILE}"
|
cat << EOF >> "${MYSHELLCONFIG_LOGFILE}"
|
||||||
Check for local changes:
|
|
||||||
Ich habe lokale Änderungen festgestellt
|
|
||||||
um die Änderung zurückzusetzen bitte
|
um die Änderung zurückzusetzen bitte
|
||||||
|
|
||||||
$SGIT checkout \$FILENAME
|
$SGIT checkout \$FILENAME
|
||||||
|
@ -67,14 +75,13 @@ Check for local changes:
|
||||||
ausführen
|
ausführen
|
||||||
|
|
||||||
Die Änderungen sind:
|
Die Änderungen sind:
|
||||||
|
$($SGIT diff-index HEAD --|awk '{print $5, $6}')
|
||||||
|
$($SGIT diff-index -p HEAD --)
|
||||||
EOF
|
EOF
|
||||||
$SGIT diff-index HEAD --|awk '{print $5, $6}' >> "${MYSHELLCONFIG_LOGFILE}"
|
|
||||||
$SGIT diff-index -p HEAD -- >> "${MYSHELLCONFIG_LOGFILE}"
|
|
||||||
|
|
||||||
logwarn "Lokale Änderungen festgestellt: Siehe Logfile ${MYSHELLCONFIG_LOGFILE}" >&2
|
|
||||||
cat << EOF >> "${MYSHELLCONFIG_LOGFILE}"
|
cat << EOF >> "${MYSHELLCONFIG_LOGFILE}"
|
||||||
|
|
||||||
+-----ENDE $(date) ---------------------------------+
|
+-----ENDE git update repo $(date) ---------------------------------+
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
exit 4
|
exit 4
|
||||||
|
@ -108,7 +115,7 @@ if ${MYSHELLCONFIG_GIT_SUBMODULES_UPDATE-${MYSHELLCONFIG_GIT_SUBMODULES_UPDATE_D
|
||||||
# run git submodule sync only ich local repo should use submodule urls from main-project
|
# run git submodule sync only ich local repo should use submodule urls from main-project
|
||||||
# so don't use it here
|
# so don't use it here
|
||||||
# logdebug "$($SGIT submodule sync)" || { logwarn "sync submodules failed on sync"; rc=6; }
|
# logdebug "$($SGIT submodule sync)" || { logwarn "sync submodules failed on sync"; rc=6; }
|
||||||
logdebug "$($SGIT submodule update --remote)"
|
#logdebug "$($SGIT submodule update --remote)"
|
||||||
logdebug "$($SGIT submodule update --init --recursive)"
|
logdebug "$($SGIT submodule update --init --recursive)"
|
||||||
logdebug "$($SGIT commit .gitmodules -m 'update submodules')"
|
logdebug "$($SGIT commit .gitmodules -m 'update submodules')"
|
||||||
#$SGIT submodule update --init --remote --merge 1>>"${MYSHELLCONFIG_LOGFILE}" 2>&1 || { logwarn " update submodules failed on update"; rc=9; }
|
#$SGIT submodule update --init --remote --merge 1>>"${MYSHELLCONFIG_LOGFILE}" 2>&1 || { logwarn " update submodules failed on update"; rc=9; }
|
||||||
|
|
Loading…
Reference in a new issue