X-Git-Url: https://git.distorted.org.uk/~mdw/mirror-admin/blobdiff_plain/2391715a287fdfa2cc0a1893ff638f7fc85a00b0..0fe058e9a36482f8d15abb83471439d8d9f8e538:/bin/debian-excludes diff --git a/bin/debian-excludes b/bin/debian-excludes new file mode 100755 index 0000000..bac4992 --- /dev/null +++ b/bin/debian-excludes @@ -0,0 +1,52 @@ +#! /bin/sh + +set -e +case $# in + 0 | 1 | 2 | 3) + echo >&2 "Usage: $0 HOST PATH ARCH:ARCH:... DIST..." + exit 1 + ;; + *) + RSYNC_HOST=$1 RSYNC_PATH=$2 WANT_ARCH=$3; shift 3 + ;; +esac + +## Check the available distributions for architectures. +for dist in "$@"; do + rsync --list-only $RSYNC_HOST::$RSYNC_PATH/dists/$dist/main/ +done | { + + ## Gather up excluded architectures as we go. + excludes="" + + while read mode size date time name; do + + ## Check directories of binary packages. If it's an architecture we + ## don't want to reject, then continue on. + case "$name" in + binary-all) + continue + ;; + binary-*) + arch=${name#binary-} + case ":$WANT_ARCH:" in *:"$arch":*) continue ;; esac + ;; + *) + continue + ;; + esac + + ## Pick out the architecture name. Check whether we've seen it before. + arch=${name#binary-} + case " $excludes " in + *" $arch "*) + ;; + *) + excludes="${excludes+$excludes }$arch" + ;; + esac + done + + ## Done. Print out the finished list. + echo $excludes +}