bin/debian-excludes: Use rsync program configured in RSYNC variable.
[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.
db23de43 15: ${RSYNC="rsync"}
0fe058e9 16for dist in "$@"; do
db23de43 17 $RSYNC --list-only $RSYNC_HOST::$RSYNC_PATH/dists/$dist/main/
0fe058e9
MW
18done | {
19
20 ## Gather up excluded architectures as we go.
21 excludes=""
22
23 while read mode size date time name; do
24
25 ## Check directories of binary packages. If it's an architecture we
26 ## don't want to reject, then continue on.
27 case "$name" in
28 binary-all)
29 continue
30 ;;
31 binary-*)
32 arch=${name#binary-}
33 case ":$WANT_ARCH:" in *:"$arch":*) continue ;; esac
34 ;;
35 *)
36 continue
37 ;;
38 esac
39
40 ## Pick out the architecture name. Check whether we've seen it before.
41 arch=${name#binary-}
42 case " $excludes " in
43 *" $arch "*)
44 ;;
45 *)
46 excludes="${excludes+$excludes }$arch"
47 ;;
48 esac
49 done
50
51 ## Done. Print out the finished list.
52 echo $excludes
53}