| 1 | ### -*-sh-*- |
| 2 | ### |
| 3 | ### ftpsync configuration for the Debian main archive. |
| 4 | |
| 5 | ## Mirrorname. This is used for things like the trace file and should always |
| 6 | ## be the full hostname of the mirror. |
| 7 | #MIRRORNAME=`hostname -f` |
| 8 | |
| 9 | ## Destination of the mirrored files. Should be an empty directory. |
| 10 | ## CAREFUL, this directory will contain the mirror. Everything else that |
| 11 | ## might have happened to be in there WILL BE GONE after the mirror sync! |
| 12 | TO="/mnt/ftp/pub/mirrors/debian/" |
| 13 | |
| 14 | ## The upstream name of the rsync share. |
| 15 | RSYNC_PATH="debian" |
| 16 | |
| 17 | ## The host we mirror from |
| 18 | RSYNC_HOST=ftp.de.debian.org |
| 19 | |
| 20 | ## In case we need a user to access the rsync share at our upstream host |
| 21 | #RSYNC_USER= |
| 22 | |
| 23 | ## If we need a user we also need a password |
| 24 | #RSYNC_PASSWORD= |
| 25 | |
| 26 | ## In which directory should logfiles end up |
| 27 | ## Note that BASEDIR defaults to $HOME, but can be set before calling the |
| 28 | ## ftpsync script to any value you want (for example using pam_env) |
| 29 | #LOGDIR="${BASEDIR}/log" |
| 30 | |
| 31 | ## Name of our own logfile. |
| 32 | ## Note that ${NAME} is set by the ftpsync script depending on the way it |
| 33 | ## is called. See README for a description of the multi-archive capability |
| 34 | ## and better always include ${NAME} in this path. |
| 35 | #LOG="${LOGDIR}/${NAME}.log" |
| 36 | |
| 37 | ## The script can send logs (or error messages) to a mail address. |
| 38 | ## If this is unset it will default to the local root user unless it is run |
| 39 | ## on a .debian.org machine where it will default to the mirroradm people. |
| 40 | #MAILTO="root" |
| 41 | |
| 42 | ## If you do want a mail about every single sync, set this to false |
| 43 | ## Everything else will only send mails if a mirror sync fails |
| 44 | #ERRORSONLY="true" |
| 45 | |
| 46 | ## If you want the logs to also include output of rsync, set this to true. |
| 47 | ## Careful, the logs can get pretty big, especially if it is the first mirror |
| 48 | ## run |
| 49 | #FULLLOGS="false" |
| 50 | |
| 51 | ## If you do want to exclude files from the mirror run, put --exclude |
| 52 | ## statements here. See rsync(1) for the exact syntax, these are passed to |
| 53 | ## rsync as written here. DO NOT TRY TO EXCLUDE ARCHITECTURES OR SUITES WITH |
| 54 | ## THIS, IT WILL NOT WORK! |
| 55 | #EXCLUDE="" |
| 56 | |
| 57 | ## If you do want to exclude an architecture, this is for you. |
| 58 | ## Use as space seperated list. |
| 59 | ## Possible values are: |
| 60 | ## alpha, amd64, arm, armel, hppa, hurd-i386, i386, ia64, kfreebsd-amd64, |
| 61 | ## kfreebsd-i386, m68k, mipsel, mips, powerpc, s390, sh, sparc and source |
| 62 | ## eg. ARCH_EXCLUDE="alpha arm armel mipsel mips s390 sparc" |
| 63 | ## An unset value will mirror all architectures (default!) |
| 64 | #ARCH_EXCLUDE="" |
| 65 | |
| 66 | ## Actually, no: we want to /include/ only some architectures. So we need to |
| 67 | ## find out which ones are available so that we can exclude the ones we don't |
| 68 | ## want. Crazy, no? |
| 69 | ARCH_EXCLUDE=$( |
| 70 | |
| 71 | ## Check the available distributions for architectures. |
| 72 | for dist in oldstable stable testing unstable experimental; do |
| 73 | rsync --list-only $RSYNC_HOST::$RSYNC_PATH/dists/$dist/main/ |
| 74 | done | { |
| 75 | |
| 76 | ## Gather up excluded architectures as we go. |
| 77 | excludes="" |
| 78 | |
| 79 | while read mode size date time name; do |
| 80 | |
| 81 | ## Check directories of binary packages. If it's an architecture we |
| 82 | ## don't want to reject, then continue on. |
| 83 | case "$name" in |
| 84 | (binary-all | binary-i386 | binary-amd64) continue ;; |
| 85 | (binary-*) ;; |
| 86 | (*) continue ;; |
| 87 | esac |
| 88 | |
| 89 | ## Pick out the architecture name. Check whether we've seen it before. |
| 90 | arch=${name#binary-} |
| 91 | case " $excludes " in |
| 92 | (*" $arch "*) |
| 93 | ;; |
| 94 | (*) |
| 95 | excludes="${excludes+$excludes }$arch" |
| 96 | ;; |
| 97 | esac |
| 98 | done |
| 99 | |
| 100 | ## Done. Print out the finished list. |
| 101 | echo $excludes |
| 102 | } |
| 103 | ) |
| 104 | |
| 105 | ## Do we have leaf mirror to signal we are done and they should sync? |
| 106 | ## If so set it to true and make sure you configure runmirrors.mirrors |
| 107 | ## and runmirrors.conf for your need. |
| 108 | #HUB=false |
| 109 | |
| 110 | ## We do create three logfiles for every run. To save space we rotate them, |
| 111 | ## this defines how many we keep |
| 112 | #LOGROTATE=14 |
| 113 | |
| 114 | ## Our own lockfile (only one sync should run at any time) |
| 115 | #LOCK="${TO}/Archive-Update-in-Progress-${MIRRORNAME}" |
| 116 | |
| 117 | ## Timeout for the lockfile, in case we have bash older than v4 (and no |
| 118 | ## /proc) |
| 119 | # LOCKTIMEOUT=${LOCKTIMEOUT:-3600} |
| 120 | |
| 121 | ## The following file is used to make sure we will end up with a correctly |
| 122 | ## synced mirror even if we get multiple pushes in a short timeframe |
| 123 | #UPDATEREQUIRED="${TO}/Archive-Update-Required-${MIRRORNAME}" |
| 124 | |
| 125 | ## The trace file is used by a mirror check tool to see when we last had a |
| 126 | ## successful mirror sync. Make sure that it always ends up in project/trace |
| 127 | ## and always shows the full hostname. This is *relative* to ${TO} |
| 128 | #TRACE="project/trace/${MIRRORNAME}" |
| 129 | |
| 130 | ## We sync our mirror using rsync (everything else would be insane), so |
| 131 | ## we need a few options set. |
| 132 | ## The rsync program |
| 133 | RSYNC="timeout 6h rsync" |
| 134 | |
| 135 | ## BE VERY CAREFUL WHEN YOU CHANGE THE RSYNC_OPTIONS! BETTER DON'T! |
| 136 | ## BE VERY CAREFUL WHEN YOU CHANGE THE RSYNC_OPTIONS! BETTER DON'T! |
| 137 | ## BE VERY CAREFUL WHEN YOU CHANGE THE RSYNC_OPTIONS! BETTER DON'T! |
| 138 | ## BE VERY CAREFUL WHEN YOU CHANGE THE RSYNC_OPTIONS! BETTER DON'T! |
| 139 | |
| 140 | ## limit I/O bandwidth. Value is KBytes per second, unset or 0 means |
| 141 | ## unlimited |
| 142 | #RSYNC_BW="" |
| 143 | |
| 144 | ## Default rsync options every rsync invocation sees. |
| 145 | #RSYNC_OPTIONS="-prltvHSB8192 --timeout 3600 --stats --exclude Archive-Update-in-Progress-${MIRRORNAME} --exclude ${TRACE} --exclude Archive-Update-Required-${MIRRORNAME}" |
| 146 | |
| 147 | ## Options the first pass gets. We do not want the Packages/Source indices |
| 148 | ## here, and we also do not want to delete any files yet. |
| 149 | #RSYNC_OPTIONS1="--exclude Packages* --exclude Sources* --exclude Release* --exclude InRelease --exclude ls-lR*" |
| 150 | |
| 151 | ## Options the second pass gets. Now we want the Packages/Source indices too |
| 152 | ## and we also want to delete files. We also want to delete files that are |
| 153 | ## excluded. |
| 154 | #RSYNC_OPTIONS2="--max-delete=40000 --delay-updates --delete --delete-after --delete-excluded" |
| 155 | |
| 156 | ## You may establish the connection via a web proxy by setting the |
| 157 | ## environment variable RSYNC_PROXY to a hostname:port pair pointing to your |
| 158 | ## web proxy. Note that your web proxy's configuration must support proxy |
| 159 | ## connections to port 873. |
| 160 | # RSYNC_PROXY= |
| 161 | |
| 162 | ## The following three options are used in case we want to "callback" the |
| 163 | ## host we got pushed from. |
| 164 | #CALLBACKUSER="archvsync" |
| 165 | #CALLBACKHOST="none" |
| 166 | #CALLBACKKEY="none" |
| 167 | |
| 168 | ## Hook scripts can be run at various places during the sync. |
| 169 | ## Leave them blank if you don't want any |
| 170 | ## Hook1: After lock is acquired, before first rsync |
| 171 | ## Hook2: After first rsync, if successful |
| 172 | ## Hook3: After second rsync, if successful |
| 173 | ## Hook4: Right before leaf mirror triggering |
| 174 | ## Hook5: After leaf mirror trigger, only if we have slave mirrors (HUB=true) |
| 175 | ## |
| 176 | ## Note that Hook3 and Hook4 are likely to be called directly after each |
| 177 | ## other. Difference is: Hook3 is called *every* time the second rsync was |
| 178 | ## successful, but even if the mirroring needs to re-run thanks to a second |
| 179 | ## push. Hook4 is only effective if we are done with mirroring. |
| 180 | #HOOK1= |
| 181 | #HOOK2= |
| 182 | #HOOK3= |
| 183 | #HOOK4= |
| 184 | #HOOK5= |