Commit | Line | Data |
---|---|---|
0fe058e9 MW |
1 | #! /bin/sh |
2 | ||
3 | set -e | |
4 | case $# 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 | ;; | |
12 | esac | |
13 | ||
14 | ## Check the available distributions for architectures. | |
15 | for dist in "$@"; do | |
16 | rsync --list-only $RSYNC_HOST::$RSYNC_PATH/dists/$dist/main/ | |
17 | done | { | |
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 | } |