aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2020-01-03 22:46:52 -0800
committerRobin H. Johnson <robbat2@gentoo.org>2020-01-03 22:46:52 -0800
commita0f66968aeea03e846bd7df54b489ce087f905d9 (patch)
tree053bffaf744db2790d82565908ca63583d58b801
parentsnapshots-create.sh: try to debug cleanup calls (diff)
downloadmastermirror-scripts-a0f66968aeea03e846bd7df54b489ce087f905d9.tar.gz
mastermirror-scripts-a0f66968aeea03e846bd7df54b489ce087f905d9.tar.bz2
mastermirror-scripts-a0f66968aeea03e846bd7df54b489ce087f905d9.zip
snapshots-create.sh: fix cleanup bug20200104T064716Z
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
-rwxr-xr-xsnapshots-create.sh29
1 files changed, 23 insertions, 6 deletions
diff --git a/snapshots-create.sh b/snapshots-create.sh
index 47da056..d03c1b5 100755
--- a/snapshots-create.sh
+++ b/snapshots-create.sh
@@ -353,17 +353,34 @@ write_time_log "END SYMLINK $(date -u)"
# 7) tidy up
write_time_log "START CLEANUP $(date -u)"
-cd "${TEMP}"
-rm -v -f orig \
- "${FILENAME%.bz2}"{.bz2,.xz}{,.umd5sum} \
- "${FILENAME_NEW%.xz}"{.bz2,.xz}{,.umd5sum} \
- "${EXCLUSION_LIST}" \
+
+# Cleanup immediate stuff
+rm -v -f \
+ "${TEMP}"/orig \
+ "${TEMP}"/"${FILENAME%.bz2}"{.bz2,.xz,}{,.umd5sum} \
+ "${TEMP}"/"${FILENAME_NEW%.xz}"{.bz2,.xz,}{,.umd5sum} \
+ "${TEMP}"/"${EXCLUSION_LIST}" \
|| exit $?
-/usr/bin/find "${UPLOAD}" \
+# Cleanup older stuff that might have leaked
+/usr/bin/find \
+ "${TEMP}" \
+ -regextype egrep \
+ -maxdepth 1 \
+ -type f \
+ -mtime +0 \
+ \( \
+ -regex '.*/(portage|gentoo)-[0-9]{6}.*' \
+ -o \
+ -name 'snapshot-exclude*' \
+ \)
+# Cleanup old snapshots
+/usr/bin/find \
+ "${UPLOAD}" \
-maxdepth 1 \
-type f \
-mtime +${HISTORY} \
-delete
+
write_time_log "END CLEANUP $(date -u)"
# end 7)