diff options
author | Erich Eckner <git@eckner.net> | 2020-05-21 11:49:08 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2020-05-21 11:49:08 +0200 |
commit | 991bae95633c45186cb67391655cf65544c935f3 (patch) | |
tree | c5c883a217440543847c9cfa0027ca2c856542c1 | |
parent | f5b04e8470d047b15648c2f3655d549688802309 (diff) | |
download | arch-mirror-991bae95633c45186cb67391655cf65544c935f3.tar.xz |
arch-mirror: only rsync --delete-after on last run
-rwxr-xr-x | arch-mirror | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/arch-mirror b/arch-mirror index 72456e1..d2ecf97 100755 --- a/arch-mirror +++ b/arch-mirror @@ -11,7 +11,7 @@ fi mirror_dir='/srv/http/arch' -rsync_options='-rtlHp --safe-links --delete-after --timeout=600 --contimeout=60 --delay-updates --no-motd --temp-dir='"${mirror_dir}"'/.tmp --exclude .tmp --exclude .~tmp~' +rsync_options='-rtlHp --safe-links --timeout=600 --contimeout=60 --delay-updates --no-motd --temp-dir='"${mirror_dir}"'/.tmp --exclude .tmp --exclude .~tmp~' if stty &>/dev/null; then rsync_verbose='-v' @@ -62,6 +62,7 @@ retrieve_file() { retrieve_content() { local url="$1" local destination="$2" + local level="$3" if [ -z "${destination##*/archlinuxarm/}" ]; then extra_options='--exclude os' @@ -69,6 +70,10 @@ retrieve_content() { unset extra_options fi + if [ "${level}" -eq 2 ]; then + extra_options="${extra_options} --delete-after" + fi + case "${url%%://*}" in 'rsync') rsync ${rsync_options} ${rsync_verbose} ${extra_options} "${url}" "${destination}" @@ -248,7 +253,7 @@ if [ $# -eq 2 ] && [ "$1" = 'mirror' ]; then if [ "${level}" -le "${last_successful_level}" ]; then continue fi - if retrieve_content "${url}" "${mirror_dir}${to_sync}"; then + if retrieve_content "${url}" "${mirror_dir}${to_sync}" "${level}"; then last_successful_level="${level}" fi done |