#!/bin/bash # Copyright 2014-2015 Gentoo Foundation; Distributed under the GPL v2 DATADIR="/data/gmirror-distfiles" LOGDIR="${DATADIR}/log" RSYNC="/usr/bin/rsync" RSYNC_ARGS="--no-motd --recursive --times --links --ignore-errors --timeout=300 --quiet" RSYNC_ARGS_DELETE="--delete --delete-after" [[ -d ${LOGDIR} ]] || mkdir ${LOGDIR} # get the helper files ${RSYNC} ${RSYNC_ARGS} ${RSYNC_ARGS_DELETE} \ woodpecker.gentoo.org::distfiles-local/ \ ${DATADIR}/distfiles-local # Do NOT delete old whitelist entries; they must explicitly be set to empty if # you want to remove them. ${RSYNC} ${RSYNC_ARGS} \ woodpecker.gentoo.org::distfiles-whitelist/ \ ${DATADIR}/distfiles-whitelist # Copy distfiles-local files to distfiles dir so that emirrordist can process # them # Do NOT --delete, let emirrordist handle the deletion logic # TODO: we could make this a hardlink for speed? ${RSYNC} ${RSYNC_ARGS} \ ${DATADIR}/distfiles{-local/*,} # build one master file due to bug 500030 cat $(/usr/bin/find ${DATADIR}/distfiles-whitelist -type f ) > \ ${DATADIR}/tmp/whitelist-master.txt # Clear out the success/fail.log so that we can report on it # (emirrordist appends) > ${LOGDIR}/failure.log if [[ $(/bin/date '+%k') -eq 0 ]]; then > ${LOGDIR}/success.log fi # human readable time format, 1814400 seconds equals 3 weeks DELAY=1814400 # WHEN you convert away from Python2, the .gdbm files need to be converted for # the key encoding! python2 /usr/bin/emirrordist \ --distfiles=${DATADIR}/distfiles/ \ --delete --jobs=10 --repo=gentoo \ --deletion-delay=${DELAY} \ --failure-log=${LOGDIR}/failure.log \ --success-log=${LOGDIR}/success.log \ --scheduled-deletion-log=${LOGDIR}/deletion.log \ --deletion-db=${LOGDIR}/deletion-db.bdb \ --distfiles-db=${LOGDIR}/distfile-db.bdb \ --recycle-db=${LOGDIR}/recycle-db.gdbm \ --recycle-dir=${DATADIR}/distfiles-archive/ \ --temp-dir=${DATADIR}/tmp/ \ --whitelist-from=${DATADIR}/tmp/whitelist-master.txt \ --distfiles-local=${DATADIR}/distfiles-local \ --mirror /bin/date -u '+%s' > ${DATADIR}/distfiles/timestamp.mirmon