aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2019-12-05 21:09:24 -0800
committerRobin H. Johnson <robbat2@gentoo.org>2019-12-05 21:09:24 -0800
commit01d0d6cc4cffa99278a8438ccda24b4dd71eb906 (patch)
treebc658b5a349673cb0a21e589128a54654a52da85 /sync-distfiles.sh
parentCreate a INDEX of distfiles (diff)
downloadmastermirror-scripts-01d0d6cc4cffa99278a8438ccda24b4dd71eb906.tar.gz
mastermirror-scripts-01d0d6cc4cffa99278a8438ccda24b4dd71eb906.tar.bz2
mastermirror-scripts-01d0d6cc4cffa99278a8438ccda24b4dd71eb906.zip
sync-distfiles.sh: better rotation of INDEX files to verify changes
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Diffstat (limited to 'sync-distfiles.sh')
-rwxr-xr-xsync-distfiles.sh13
1 files changed, 11 insertions, 2 deletions
diff --git a/sync-distfiles.sh b/sync-distfiles.sh
index 302fb92..ce6c4c5 100755
--- a/sync-distfiles.sh
+++ b/sync-distfiles.sh
@@ -57,8 +57,17 @@ python2 /usr/bin/emirrordist \
--layout-conf=/usr/local/bin/mastermirror/layout.conf.new \
--mirror
+INDEXNAME=.INDEX.$(date -u +%Y%m%d%H%M%S).txt
+INDEXFILE=${DATADIR}/${INDEXNAME}
( cd ${DATADIR}/distfiles && find [0-9a-f][0-9a-f] -mindepth 1 ) |
- sort > ${DATADIR}/INDEX.tmp &&
- mv ${DATADIR}/INDEX.tmp ${DATADIR}/distfiles/INDEX
+ sort >"${INDEXFILE}.tmp" && \
+ mv "${INDEXFILE}.tmp" "${INDEXFILE}" && \
+ ln -sf "${INDEXNAME}" "${DATADIR}"/INDEX && \
+ find "$DATADIR" \
+ -maxdepth 1 \
+ -mindepth 1 \
+ -name '.INDEX.*.txt' \
+ ! -mtime -7 \
+ -delete
/bin/date -u '+%s' > ${DATADIR}/distfiles/timestamp.mirmon