Commit 0fad1c7f authored by Seblu's avatar Seblu

Properly handle rsync errors

Do not update timed links and packages index when repo_rsync failed.
parent bc98d8d5
......@@ -103,12 +103,16 @@ repo_rsync() {
msg2 'Rsyncing...'
# rsync from master using last sync
# we must use absolute path with --link-dest to avoid errors
timeout $REPO_RSYNC_TIMEOUT rsync -rltH $LINKDEST \
--filter ". $FILTER_FILE" "$ARCHIVE_RSYNC" "$SNAP/" ||
if ! timeout $REPO_RSYNC_TIMEOUT rsync -rltH $LINKDEST \
--filter ". $FILTER_FILE" "$ARCHIVE_RSYNC" "$SNAP/"; then
error "Unable to rsync: $ARCHIVE_RSYNC."
return 1
fi
# only to have a quick check of sync in listdir
touch "$SNAP"
return 0
}
# output the last repository snapshot
......@@ -220,9 +224,12 @@ iso_rsync() {
[[ -d "$ISO_DIR" ]] || mkdir -p "$ISO_DIR"
# Rsync from master using last sync
timeout $ISO_RSYNC_TIMEOUT rsync -vrltH "$ISO_RSYNC" \
--include='/????.??.??/***' --exclude='*' "$ISO_DIR/" ||
if ! timeout $ISO_RSYNC_TIMEOUT rsync -vrltH "$ISO_RSYNC" \
--include='/????.??.??/***' --exclude='*' "$ISO_DIR/"; then
error "Unable to rsync: $ISO_RSYNC."
return 1
fi
return 0
}
main() {
......@@ -250,11 +257,13 @@ main() {
if (( $ARCHIVE_REPO )); then
REPO_DIR="$ARCHIVE_DIR/repos"
repo_rsync
(( $REPO_DAYLY )) && repo_daily
if repo_rsync; then
# do not update daily links when rsync fail. this could end-up with a
# last pointing to an empty repo.
(( $REPO_DAYLY )) && repo_daily
(( $REPO_PACKAGES )) && repo_packages
fi
(( $REPO_PACKAGES )) && repo_packages
fi
(( $ARCHIVE_ISO )) && iso_rsync
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment