summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2010-06-25 21:52:38 +0200
committerPierre Schmitz <pierre@archlinux.de>2010-06-25 21:52:38 +0200
commitf16a290a06d404722d53f6b38e567e340f9d7387 (patch)
treeb128d46774f33d1fd785873e3bc709a9272f2992
parent7824ead91e5b27474bdedde411b3db7c4c1a1ace (diff)
downloadrepo-tools-f16a290a06d404722d53f6b38e567e340f9d7387.tar.gz
repo-tools-f16a290a06d404722d53f6b38e567e340f9d7387.tar.xz
make sync more atomic
-rwxr-xr-xsyncrepo17
1 files changed, 7 insertions, 10 deletions
diff --git a/syncrepo b/syncrepo
index f8975ff..e851c0b 100755
--- a/syncrepo
+++ b/syncrepo
@@ -2,24 +2,21 @@
home="$(dirname "${0}")"
target="${home}/repo"
+tmp="${home}/tmp"
lock='/tmp/mirrorsync.lck'
source='-e ssh gerolde.archlinux.org:/srv/ftp'
repos='core,extra,testing,community,community-testing'
-[ ! -d "${target}" ] && exit 1
+[ ! -d "${target}" ] && mkdir -p "${target}"
+[ ! -d "${tmp}" ] && mkdir -p "${tmp}"
[ -f "${lock}" ] && exit 1
touch "${lock}"
trap "rm -f '${lock}'" EXIT INT TERM
-rsync -rptlv --safe-links --delete --progress -h \
- --include='*/' \
- --include='*.db.tar.gz' \
- --exclude='*' \
- ${source}/{${repos}} \
- "${target}"
-
-rsync -rptlv --safe-links --delete --progress -h \
- --exclude='*.db.tar.gz*' \
+rsync -rtlvH --safe-links --delete-after --progress -h \
+ --partial \
+ --partial-dir="${tmp}" \
+ --delay-updates \
--exclude='*.abs.tar.gz*' \
--exclude='*.files.tar.gz*' \
--exclude='*.links.tar.gz*' \