]> asedeno.scripts.mit.edu Git - sipb-mirrors.git/blob - fetch-scripts/fedora-epel
fedora and fedora-epel: abusing DESTD to limit scope and hopefully appease rsync
[sipb-mirrors.git] / fetch-scripts / fedora-epel
1 #!/bin/bash
2
3 # mirrors.mit.edu is on the IP ACL for fedora-buffet0 here
4 # so we'll use it. Adjust these values if switching upstreams.
5 RSYNCSOURCE=rsync://download-i2.fedoraproject.org
6 MASTERMODULE=fedora-buffet0
7 PREBITFLIP=1
8
9 # The remote module we want to sync from fedora-buffet[0].
10 # Some call it epel, others call it fedora-epel.
11 MODULE=epel
12
13 # Normally, quick-fedora-mirror is used to mirror multiple modules,
14 # and wants DESTD to point at the root. However, we're using it for
15 # single modules, and it seems to choke on the symlink farm.
16 # Setting DESTD to the module location and forcing telling qfm to
17 # put the module in `.`.
18
19 DESTD="${MIRRORDIR}/epel"
20
21 TIMEFILE="${MIRRORDIR}/.locks/fedora-epel.timefile"
22 QFM="./tools/fedora/quick-fedora-mirror"
23
24 if ! [ -x "${QFM}" ]; then
25     # It is expected that this script is sourced by fetch-hudson
26     # and that cwd is the workspace where the root of this repository
27     # is checked out.
28     echo "Could not find quick-fedora-mirror."
29     exit 1
30 fi
31
32 exittrap() { :; }
33 trap 'exittrap' EXIT
34
35 TMPDIR=$(mktemp -d /tmp/fedora-epel.XXXXXX) || die "Unable to mktemp"
36 exittrap() { rm -rf "${TMPDIR}"; }
37
38 CONF="${TMPDIR}/qfm.conf"
39 cat >"${CONF}" <<EOF
40 # This will be sourced by qfm, which uses zsh.
41 # Where our mirrors live
42 DESTD=${DESTD}
43 # State regarding last sync, and also a lockfile for qfm
44 TIMEFILE=${TIMEFILE}
45 # Upstream mirror that contains MASTERMODULE
46 REMOTE=${RSYNCSOURCE}
47 MASTERMODULE=${MASTERMODULE}
48 PREBITFLIP=${PREBITFLIP}
49 # Which module to sync
50 MODULES=(${MODULE})
51 # Map from module to location; which we're forcing to .
52 MODULEMAPPING=(${MODULE} .)
53 # One -v to rsync
54 VERBOSE=4
55 EOF
56
57 "${QFM}" --config "${CONF}"
58
59 rm -rf "${TMPDIR}"
60 exittrap() { :; }