Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbuild-iso4
-rwxr-xr-xcheck-iso4
-rwxr-xr-xcleanup-isos101
3 files changed, 105 insertions, 4 deletions
diff --git a/build-iso b/build-iso
index 258e30a..1b71369 100755
--- a/build-iso
+++ b/build-iso
@@ -94,7 +94,7 @@ while [ $# -gt 0 ]; do
break
;;
*)
- >&2 printf 'Whoops, option "%s" is not yet implemented!\n' "$1" >&2
+ >&2 printf 'Whoops, option "%s" is not yet implemented!\n' "$1"
exit 42
;;
esac
@@ -102,7 +102,7 @@ while [ $# -gt 0 ]; do
done
if [ $# -gt 0 ]; then
- >&2 echo 'Too many arguments.' >&2
+ >&2 echo 'Too many arguments.'
exit 2
fi
diff --git a/check-iso b/check-iso
index 65b2c57..6d2d6c1 100755
--- a/check-iso
+++ b/check-iso
@@ -108,7 +108,7 @@ while [ $# -gt 0 ]; do
break
;;
*)
- >&2 printf 'Whoops, option "%s" is not yet implemented!\n' "$1" >&2
+ printf 'Whoops, option "%s" is not yet implemented!\n' "$1" >&2
exit 42
;;
esac
@@ -116,7 +116,7 @@ while [ $# -gt 0 ]; do
done
if [ $# -gt 0 ]; then
- >&2 echo 'Too many arguments.' >&2
+ >&2 echo 'Too many arguments.'
exit 2
fi
diff --git a/cleanup-isos b/cleanup-isos
new file mode 100755
index 0000000..5b46a8e
--- /dev/null
+++ b/cleanup-isos
@@ -0,0 +1,101 @@
+#!/bin/bash
+
+# parameters
+MIRROR_DIR="/srv/http/mirror/mirror.archlinux32.org"
+ARCHIVE_DIR="/srv/http/mirror/archive.archlinux32.org/iso"
+
+usage() {
+ >&2 echo ""
+ >&2 echo "cleanup-isos: cleanup mirror and archive ISOs of Archlinux32"
+ >&2 echo ""
+ >&2 echo "possible options:"
+ >&2 echo " -h|--help: show this help and exit."
+ >&2 echo " --mirror-dir where are the ISOs stored on the mirror, default is '$MIRROR_DIR'."
+ >&2 echo " --archive-dir where are the ISOs stored in the archive, default is '$ARCHIVE_DIR'."
+ >&2 echo " -n do not do anything, just print what would be done."
+ [ -z "$1" ] && exit 1 || exit "$1"
+}
+
+# fail on first error
+set -e
+
+# cleanup hook
+tmp_dir="$(mktemp -d)"
+cleanup() {
+ rm -rf --one-file-system "${tmp_dir}"
+}
+trap cleanup EXIT
+
+eval set -- "$(
+ getopt -o hn \
+ --long help \
+ --long mirror-dir: \
+ --long archive-dir: \
+ -n "$(basename "$0")" -- "$@" || \
+ echo usage
+)"
+
+mirror_dir="${MIRROR_DIR}"
+archive_dir="${ARCHIVE_DIR}"
+do_it=1
+
+while [ $# -gt 0 ]; do
+ case "$1" in
+ '--mirror-dir')
+ shift
+ mirror_dir="$1"
+ ;;
+ '--archive-dir')
+ shift
+ archive_dir="$1"
+ ;;
+ '-n')
+ do_it=0
+ ;;
+ '--help'|'-h')
+ usage 0
+ ;;
+ '--')
+ shift
+ break
+ ;;
+ *)
+ printf 'Whoops, option "%s" is not yet implemented!\n' "$1" >&2
+ exit 42
+ ;;
+ esac
+ shift
+done
+
+if [ $# -gt 0 ]; then
+ >&2 echo 'Too many arguments.'
+ exit 2
+fi
+
+echo "checking for old isos in '${mirror_dir}'..."
+
+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.'
+ ;;
+
+
+