added modules
This commit is contained in:
@@ -54,3 +54,24 @@ while IFS= read -r old_file; do
|
||||
done < <(ls -t "$BACKUP_DIR"/[0-9]*.zip 2>/dev/null | tail -n +$((BACKUP_SLOTS + 1)))
|
||||
|
||||
log "Backup finished successfully."
|
||||
|
||||
# --- Custom modules snapshot ---
|
||||
# Archive /4server/data/$UUID/git-server/repos/local/custom/ into .current.tar.gz.
|
||||
# Rebuilt only when at least one file inside is newer than the existing archive,
|
||||
# so borg backup dedup sees an identical blob on unchanged runs.
|
||||
CUSTOM_SRC="/4server/data/$UUID/git-server/repos/local/custom"
|
||||
CUSTOM_ARCHIVE="$BACKUP_DIR/.current.tar.gz"
|
||||
|
||||
if [ ! -d "$CUSTOM_SRC" ]; then
|
||||
log "Custom modules directory not found, skipping: $CUSTOM_SRC"
|
||||
elif [ ! -f "$CUSTOM_ARCHIVE" ] || \
|
||||
doas find "$CUSTOM_SRC" -newer "$CUSTOM_ARCHIVE" -print -quit | grep -q .; then
|
||||
log "Changes detected in custom modules — rebuilding .current.tar.gz"
|
||||
# Write to a temp file first; mv is atomic, so borg never sees a partial archive
|
||||
doas tar -czf "${CUSTOM_ARCHIVE}.tmp" \
|
||||
-C "/4server/data/$UUID/git-server/repos/local" custom
|
||||
doas mv "${CUSTOM_ARCHIVE}.tmp" "$CUSTOM_ARCHIVE"
|
||||
log ".current.tar.gz updated: $(doas du -sh "$CUSTOM_ARCHIVE" | cut -f1)"
|
||||
else
|
||||
log "No changes in custom modules — .current.tar.gz is up to date"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user