chiark / gitweb /
bin/debian-excludes: Use rsync program configured in RSYNC variable.
[mirror-admin] / bin / debian-excludes
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 : ${RSYNC="rsync"}
16 for dist in "$@"; do
17   $RSYNC --list-only $RSYNC_HOST::$RSYNC_PATH/dists/$dist/main/
18 done | {
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 }