Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/cleanup-isos
diff options
context:
space:
mode:
Diffstat (limited to 'cleanup-isos')
-rwxr-xr-xcleanup-isos50
1 files changed, 26 insertions, 24 deletions
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.'
- ;;
-
-