summaryrefslogtreecommitdiff
path: root/bin/ftpsync
diff options
context:
space:
mode:
Diffstat (limited to 'bin/ftpsync')
-rwxr-xr-xbin/ftpsync54
1 files changed, 30 insertions, 24 deletions
diff --git a/bin/ftpsync b/bin/ftpsync
index 9cfe35e..646e9d8 100755
--- a/bin/ftpsync
+++ b/bin/ftpsync
@@ -487,17 +487,37 @@ while [ -e "${UPDATEREQUIRED}" ]; do
# if we want stage2 *or* all
if [ "xtruex" = "x${SYNCSTAGE2}x" ] || [ "xtruex" = "x${SYNCALL}x" ]; then
- log "Running stage2: ${RSYNC} ${RSYNC_OPTIONS} ${RSYNC_OPTIONS2} ${EXCLUDE} ${SOURCE_EXCLUDE} ${RSYNCPTH}::${RSYNC_PATH} ${TO}"
+ upstream_uip=false
+ for aupfile in "${TO}/Archive-Update-in-Progress-"*; do
+ case "$aupfile" in
+ "${TO}/Archive-Update-in-Progress-*")
+ :
+ ;;
+ "${LOCK}")
+ :
+ ;;
+ *)
+ upstream_uip=true
+ ;;
+ esac
+ done
- set +e
- # We are lucky, it worked. Now do step 2 and sync again, this time including
- # the packages/releases files
- ${RSYNC} ${RSYNC_OPTIONS} ${RSYNC_OPTIONS2} ${EXCLUDE} ${SOURCE_EXCLUDE} \
- ${RSYNCPTH}::${RSYNC_PATH} "${TO}" >>"${LOGDIR}/rsync-${NAME}.log" 2>>"${LOGDIR}/rsync-${NAME}.error"
- result=$?
- set -e
+ if $upstream_uip; then
+ log "Upstream archive update in progress, skipping stage2 (ignore rsync error below)"
+ result=1
+ else
+ log "Running stage2: ${RSYNC} ${RSYNC_OPTIONS} ${RSYNC_OPTIONS2} ${EXCLUDE} ${SOURCE_EXCLUDE} ${RSYNCPTH}::${RSYNC_PATH} ${TO}"
+
+ set +e
+ # We are lucky, it worked. Now do step 2 and sync again, this time including
+ # the packages/releases files
+ ${RSYNC} ${RSYNC_OPTIONS} ${RSYNC_OPTIONS2} ${EXCLUDE} ${SOURCE_EXCLUDE} \
+ ${RSYNCPTH}::${RSYNC_PATH} "${TO}" >>"${LOGDIR}/rsync-${NAME}.log" 2>>"${LOGDIR}/rsync-${NAME}.error"
+ result=$?
+ set -e
- log "Back from rsync with returncode ${result}"
+ log "Back from rsync with returncode ${result}"
+ fi
else
# Fake a good resultcode
result=0
@@ -523,21 +543,7 @@ done
# We only update our tracefile when we had a stage2 or an all sync.
# Otherwise we would update it after stage1 already, which is wrong.
if [ "xtruex" = "x${SYNCSTAGE2}x" ] || [ "xtruex" = "x${SYNCALL}x" ]; then
- should_update=true
- for aupfile in "${TO}/Archive-Update-in-Progress-"*; do
- case "$aupfile" in
- "${TO}/Archive-Update-in-Progress-*")
- :
- ;;
- "${LOCK}")
- :
- ;;
- *)
- should_update=false
- ;;
- esac
- done
- if $should_update && [ -d "$(dirname "${TO}/${TRACE}")" ]; then
+ if [ -d "$(dirname "${TO}/${TRACE}")" ]; then
LC_ALL=POSIX LANG=POSIX date -u > "${TO}/${TRACE}"
echo "Used ftpsync version: ${VERSION}" >> "${TO}/${TRACE}"
echo "Running on host: $(hostname -f)" >> "${TO}/${TRACE}"