From 94cd2a960cb13936375bee89eb39f09a31f59bda Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Fri, 11 Sep 2020 13:28:43 +0200 Subject: [PATCH 1/2] add script used to rsync repo to primary mirrors --- examples/mirror-to-mirror.sh | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 examples/mirror-to-mirror.sh diff --git a/examples/mirror-to-mirror.sh b/examples/mirror-to-mirror.sh new file mode 100644 index 00000000..de85d9ca --- /dev/null +++ b/examples/mirror-to-mirror.sh @@ -0,0 +1,9 @@ +#!/bin/bash +set -e +( +flock -n 200 +set -e +cd /home/fdroid +rsync --delay-updates --progress -a --delete /home/fdroid/public_html/archive/ fdroid@fdroid-mirror.at.or.at:/srv/fdroid-mirror.at.or.at/htdocs/fdroid/archive/ +rsync --delay-updates --progress -a --delete /home/fdroid/public_html/repo/ fdroid@fdroid-mirror.at.or.at:/srv/fdroid-mirror.at.or.at/htdocs/fdroid/repo/ +) 200>/var/lock/root_fdroidmirrortomirror From 8b406ace08df356bd5af798d5f575068d2941583 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Fri, 11 Sep 2020 13:47:13 +0200 Subject: [PATCH 2/2] mirror-to-mirror.sh: update script to handle multiple primary mirrors --- examples/mirror-to-mirror.sh | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/examples/mirror-to-mirror.sh b/examples/mirror-to-mirror.sh index de85d9ca..fa7e88b5 100644 --- a/examples/mirror-to-mirror.sh +++ b/examples/mirror-to-mirror.sh @@ -1,9 +1,24 @@ #!/bin/bash +# +# This script syncs the entire repo to the primary mirrors. It is +# meant to run in a cronjob quite frequently, as often as there are +# files to send. +# +# This script expects the receiving side to have the following +# preceeding the ssh key entry in ~/.ssh/authorized_keys: +# command="rsync --server -logDtpre.iLsfx --log-format=X --delete --delay-updates . /path/to/htdocs/fdroid/",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty +# set -e ( flock -n 200 set -e cd /home/fdroid -rsync --delay-updates --progress -a --delete /home/fdroid/public_html/archive/ fdroid@fdroid-mirror.at.or.at:/srv/fdroid-mirror.at.or.at/htdocs/fdroid/archive/ -rsync --delay-updates --progress -a --delete /home/fdroid/public_html/repo/ fdroid@fdroid-mirror.at.or.at:/srv/fdroid-mirror.at.or.at/htdocs/fdroid/repo/ +for section in repo archive; do + for host in fdroid@mirror.f-droid.org; do + # be super careful with the trailing slashes here! if one is wrong, it'll delete the entire section! + rsync --archive --delay-updates --progress --delete \ + /home/fdroid/public_html/${section} \ + ${host}:/srv/fdroid-mirror.at.or.at/htdocs/fdroid/ + done +done ) 200>/var/lock/root_fdroidmirrortomirror