mirror-to-mirror.sh: update script to handle multiple primary mirrors

This commit is contained in:
Hans-Christoph Steiner 2020-09-11 13:47:13 +02:00
parent 94cd2a960c
commit 8b406ace08
1 changed files with 17 additions and 2 deletions

View File

@ -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