blob: 1abaf2d258563fc72240831a58d4ff3b545648f1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
#!/bin/bash
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
/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 \
--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
|