Refactor the Debian mirror configuration.
[mirror-admin] / bin / debian-excludes
CommitLineData
0fe058e9
MW
1#! /bin/sh
2
3set -e
4case $# in
5 0 | 1 | 2 | 3)
6 echo >&2 "Usage: $0 HOST PATH ARCH:ARCH:... DIST..."
7 exit 1
8 ;;
9 *)
10 RSYNC_HOST=$1 RSYNC_PATH=$2 WANT_ARCH=$3; shift 3
11 ;;
12esac
13
14## Check the available distributions for architectures.
15for dist in "$@"; do
16 rsync --list-only $RSYNC_HOST::$RSYNC_PATH/dists/$dist/main/
17done | {
18
19 ## Gather up excluded architectures as we go.
20 excludes=""
21
22 while read mode size date time name; do
23
24 ## Check directories of binary packages. If it's an architecture we
25 ## don't want to reject, then continue on.
26 case "$name" in
27 binary-all)
28 continue
29 ;;
30 binary-*)
31 arch=${name#binary-}
32 case ":$WANT_ARCH:" in *:"$arch":*) continue ;; esac
33 ;;
34 *)
35 continue
36 ;;
37 esac
38
39 ## Pick out the architecture name. Check whether we've seen it before.
40 arch=${name#binary-}
41 case " $excludes " in
42 *" $arch "*)
43 ;;
44 *)
45 excludes="${excludes+$excludes }$arch"
46 ;;
47 esac
48 done
49
50 ## Done. Print out the finished list.
51 echo $excludes
52}