]> asedeno.scripts.mit.edu Git - sipb-mirrors.git/blob - fetch-scripts/raspbian
Do not do second rsync if first failed
[sipb-mirrors.git] / fetch-scripts / raspbian
1 #! /bin/bash
2
3 set -x
4 set -v
5 set -e
6 set -u
7
8 #MIRRORDIR=/ifs/mirror
9 BASEDIR=${MIRRORDIR}/raspbian
10 #RSYNCSOURCE=rsync://archive.raspbian.org/archive
11 # Temporarily sync from somewhere closer to get data faster
12 RSYNCSOURCE=rsync://lug.mtu.edu/raspbian
13
14 RSYNC_OPTS="--recursive --links --hard-links --times --sparse --hard-links --block-size=8192 --timeout 3600 --perms"
15 #OTHER_OPTS="--verbose --stats --dry-run"
16 OTHER_OPTS="--verbose --stats"
17
18 # Options we only use in the first pass, where we do not want packages/sources to fly in yet and dont want to delete files
19 PASS1="--exclude Packages\* --exclude Sources\* --exclude Release\* --exclude ls-lR\*"
20 # Options for the second pass, where we do want everything, including deletion of old and now unused files
21 PASS2="--max-delete=40000 --delay-updates --delete --delete-after --delete-excluded --exclude \"project/trace/${HOSTNAME}\""
22
23 # The temp directory used by rsync --delay-updates is not
24 # world-readable remotely. Always exclude it to avoid errors. 
25 EXCLUDE="--exclude .~tmp~/"
26
27 rsync ${RSYNC_OPTS} ${OTHER_OPTS} ${PASS1} ${EXCLUDE} ${RSYNCSOURCE} ${BASEDIR}
28 rsync ${RSYNC_OPTS} ${OTHER_OPTS} ${PASS2} ${EXCLUDE} ${RSYNCSOURCE} ${BASEDIR}
29
30 mkdir -p ${BASEDIR}/project/trace
31 date -u > ${BASEDIR}/project/trace/mirrors.mit.edu