--- anonftpsync.orig	2006-12-14 01:25:43.000000000 +1100
+++ anonftpsync	2007-01-22 14:01:13.000000000 +1100
@@ -69,6 +69,23 @@
 
 ARCH_EXCLUDE=
 
+# ARCH_INCLUDE can be used to explicitly specify a list of architectures to
+# mirrorring. Please use as space seperated list.
+# Possible values are:
+# alpha, amd64, arm, hppa, hurd-i386, i386, ia64, m68k, mipsel, mips, powerpc, s390, sh and sparc
+#
+# There is one special value: source
+# This is not an architecture but will include all source code in /pool
+#
+# eg.
+# ARCH_EXCLUDE="alpha arm hppa hurd-i386 ia64 m68k mipsel mips s390 sparc"
+# 
+# With a blank ARCH_INCLUDE you will mirror all architectures unless you have
+# excluded some using the ARCH_EXCLUDE option
+# (optional)
+
+ARCH_INCLUDE=
+
 # EXCLUDE is a list of parameters listing patterns that rsync will exclude, in
 # addition to the architectures excluded by ARCH_EXCLUDE.
 #
@@ -91,6 +108,12 @@
 
 EXCLUDE=
 
+# INCLUDE is a list of parameters listing patterns that rsync will include.
+# This can be used to override any files that will be excluded as a result of
+# other options specified (ie the ARCH_EXCLUDE or EXCLUDE options)
+
+INCLUDE=
+
 # MAILTO is the address to send logfiles to;
 # if it is not defined, no mail will be sent
 # (optional)
@@ -128,22 +152,69 @@
  
 LOCK="${TO}/Archive-Update-in-Progress-${HOSTNAME}"
 
-# Exclude architectures defined in $ARCH_EXCLUDE
-for ARCH in $ARCH_EXCLUDE; do
+# Check whether we're including or excluding architectures
+if [ -z "$ARCH_INCLUDE" ]
+then
+	# Exclude architectures defined in $ARCH_EXCLUDE
+	for ARCH in $ARCH_EXCLUDE; do
+		EXCLUDE=$EXCLUDE"\
+			--exclude binary-$ARCH/ \
+			--exclude disks-$ARCH/ \
+			--exclude installer-$ARCH/ \
+			--exclude Contents-$ARCH.gz \
+			--exclude Contents-$ARCH.diff/ \
+			--exclude *_$ARCH.deb \
+			--exclude *_$ARCH.udeb "
+		if [ "$ARCH" == "source" ]; then
+			SOURCE_EXCLUDE="\
+			--exclude *.tar.gz \
+			--exclude *.diff.gz \
+			--exclude *.dsc "
+		fi
+	done
+else
+	SOURCE_INCLUDE=
+
+	# Make sure we include binary-imdependent packages
+	INCLUDE=$INCLUDE"\
+		--include *_all.deb \
+		--include *_all.udeb "
+
+	# Include each specified architecture
+	for ARCH in $ARCH_INCLUDE; do
+		if [ "$ARCH" == "source" ]; then
+			SOURCE_INCLUDE=1
+		else
+			INCLUDE=$INCLUDE"\
+				--include binary-$ARCH/ \
+				--include disks-$ARCH/ \
+				--include installer-$ARCH/ \
+				--include Contents-$ARCH.gz \
+				--include Contents-$ARCH.diff/ \
+				--include *_$ARCH.deb \
+				--include *_$ARCH.udeb "
+		fi
+	done
+
+	# Exclude all other archs
 	EXCLUDE=$EXCLUDE"\
-		--exclude binary-$ARCH/ \
-		--exclude disks-$ARCH/ \
-		--exclude installer-$ARCH/ \
-		--exclude Contents-$ARCH.gz \
-		--exclude *_$ARCH.deb \
-		--exclude *_$ARCH.udeb "
-	if [ "$ARCH" == "source" ]; then
+		--exclude binary-*/ \
+		--exclude disks-*/ \
+		--exclude installer-*/ \
+		--exclude Contents-*.gz \
+		--exclude Contents-*.diff/ \
+		--exclude *_*.deb \
+		--exclude *_*.udeb "
+
+	# Include source if necessary
+	if [ -z "$SOURCE_INCLUDE" ]
+	then
 		SOURCE_EXCLUDE="\
-		--exclude *.tar.gz \
-		--exclude *.diff.gz \
-		--exclude *.dsc "
+			--exclude *.tar.gz \
+			--exclude *.diff.gz \
+			--exclude *.dsc "
 	fi
-done
+fi
 
 # Logfile
 LOGFILE=$LOGDIR/debian-mirror.log
@@ -166,7 +237,7 @@
 
 # First sync /pool
 rsync --recursive --links --hard-links --times --verbose \
-     $EXCLUDE $SOURCE_EXCLUDE \
+     $INCLUDE $EXCLUDE $SOURCE_EXCLUDE \
      $RSYNC_HOST::$RSYNC_DIR/pool/ $TO/pool/ >> $LOGFILE 2>&1
 result=$?
 
@@ -175,7 +246,7 @@
 	rsync --recursive --links --hard-links --times --verbose --delay-updates --delete-after \
 	     --exclude "Archive-Update-in-Progress-${HOSTNAME}" \
 	     --exclude "project/trace/${HOSTNAME}" \
-	     $EXCLUDE $SOURCE_EXCLUDE \
+	     $INCLUDE $EXCLUDE $SOURCE_EXCLUDE \
 	     $RSYNC_HOST::$RSYNC_DIR $TO >> $LOGFILE 2>&1
 
 	LANG=C date -u > "${TO}/project/trace/${HOSTNAME}"
