From a15b5d25c108df7b2d94cdecbb99f3373abbed03 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sun, 30 Jul 2017 10:46:58 +0200 Subject: syncrepo.sh: Improve documentation and remove likely useless defaults Signed-off-by: Florian Pritz --- syncrepo.sh | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/syncrepo.sh b/syncrepo.sh index 261a0dd..dc1cdea 100755 --- a/syncrepo.sh +++ b/syncrepo.sh @@ -7,18 +7,32 @@ # is run every minute. Performing a simple check via HTTP first can thus save a # lot of traffic. -target="/srv/repo" -tmp="/srv/tmp" +# Directory where the repo is stored locally. Example: /srv/repo +target="" + +# Directory where files are downloaded to before being moved in place. +# This should be on the same filesystem as $target, but not a subdirectory of $target. +# Example: /srv/tmp +tmp="" + +# Lockfile path lock="/var/lock/syncrepo.lck" # NOTE: You'll probably want to change this or set it to 0 to disable the limit # The default unit is KiB (see man rsync /--bwlimit for more) bwlimit=4096 -# NOTE: Most people reading this very likely need to change this since -# rsync.archlinux.org requires you to be a tier 1 mirror -source='rsync://rsync.archlinux.org/ftp_tier1' -lastupdate_url='http://rsync.archlinux.org/lastupdate' +# The source URL of the mirror you want to sync from. +# If you are a tier 1 mirror use rsync.archlinux.org, for example like this: +# rsync://rsync.archlinux.org/ftp_tier1 +# Otherwise chose a tier 1 mirror from this list and use its rsync URL: +# https://www.archlinux.org/mirrors/ +source_url='' + +# An HTTP(S) URL pointing to the 'lastupdate' file on your chosen mirror. +# If you are a tier 1 mirror use: http://rsync.archlinux.org/lastupdate +# Otherwise use the HTTP(S) URL from your chosen mirror. +lastupdate_url='' #### END CONFIG @@ -47,7 +61,7 @@ rsync_cmd() { # if we are called without a tty (cronjob) only run when there are changes if ! tty -s && [[ -f "$target/lastupdate" ]] && diff -b <(curl -s "$lastupdate_url") "$target/lastupdate" >/dev/null; then # keep lastsync file in sync for statistics generated by the Arch Linux website - rsync_cmd "$source/lastsync" "$target/lastsync" + rsync_cmd "$source_url/lastsync" "$target/lastsync" exit 0 fi @@ -56,7 +70,7 @@ rsync_cmd \ --exclude='/other' \ --exclude='/sources' \ --exclude='/iso' \ - "${source}" \ + "${source_url}" \ "${target}" #echo "Last sync was $(date -d @$(cat ${target}/lastsync))" -- cgit v1.2.3-24-g4f1b