index : releng | |
Archlinux32 release engineering | gitolite user |
summaryrefslogtreecommitdiff |
author | Andreas Baumann <mail@andreasbaumann.cc> | 2022-02-17 14:23:03 +0100 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2022-02-17 14:23:03 +0100 |
commit | 1c6c44cbb7a5bc883b57c2a89edf43521c64955e (patch) | |
tree | 8a4d7fec606a2e80d340f78f1c6db9da3eb9a40b /cleanup-isos | |
parent | d98ebcfca34d5a9adc0e4c2d1ad6bfdeaabbdd6d (diff) |
-rwxr-xr-x | cleanup-isos | 50 |
diff --git a/cleanup-isos b/cleanup-isos index 5b46a8e..d135a7d 100755 --- a/cleanup-isos +++ b/cleanup-isos @@ -2,7 +2,7 @@ # parameters MIRROR_DIR="/srv/http/mirror/mirror.archlinux32.org" -ARCHIVE_DIR="/srv/http/mirror/archive.archlinux32.org/iso" +ARCHIVE_DIR="/srv/http/mirror/archive.archlinux32.org" usage() { >&2 echo "" @@ -72,30 +72,32 @@ if [ $# -gt 0 ]; then exit 2 fi -echo "checking for old isos in '${mirror_dir}'..." +archiso_dir="${mirror_dir}/archisos/" +archived_archiso_dir="${archive_dir}/iso/" + +echo "checking for old isos in '${archiso_dir}'..." + +find "${archiso_dir}" \( -name 'archlinux32-*' -o -name 'archlinux-*' \) -not -name 'archlinux32-'"${date}"'-*' \ +| while read -r to_delete; do + archived_file="${archived_archiso_dir}/${to_delete#${archiso_dir}/}" + if [ -f "${to_delete}" -a -f "${archived_file}" ]; then + if diff -q "${to_delete}" "${archived_file}" >/dev/null; then + rm "${to_delete}" + printf '%s\n' "${to_delete}" \ + | sed ' + s@^.*/@@ + s/\./\\./g + s@.*@/ \0$/d@ + ' + fi + fi +done \ +>> "${tmp_dir}/delete-regex" +sed -i -f "${tmp_dir}/delete-regex" "${archiso_dir}/sha512sums" +sed -i -f "${tmp_dir}/delete-regex" "${archiso_dir}/md5sums" + +echo '... done.' exit 0 -#--TODO FROM HERE - - find "${destination}" \( -name 'archlinux32-*' -o -name 'archlinux-*' \) -not -name 'archlinux32-'"${date}"'-*' \ - | while read -r to_delete; do - if diff -q "${to_delete}" "${archive}/iso/${to_delete#${destination}/}" >/dev/null; then - rm "${to_delete}" - printf '%s\n' "${to_delete}" \ - | sed ' - s@^.*/@@ - s/\./\\./g - s@.*@/ \0$/d@ - ' - fi - done \ - >> "${tmp_dir}/delete-regex" - sed -i -f "${tmp_dir}/delete-regex" "${destination}/sha512sums" - sed -i -f "${tmp_dir}/delete-regex" "${destination}/md5sums" - - echo '... done.' - ;; - - |