#!/bin/sh
-# Count number of source packages available in Debian
+# Count the number of source packages available in Debian & Ubuntu
-if [ $# -lt 1 ]; then
- echo "Please add at least one distribution as argument"
- echo "Exiting"
+if [ $# -lt 2 ]; then
+ echo "Usage: count_source_packages <distribution> <suite>"
+ echo "where <distribution> can be either debian or ubuntu"
exit 1
fi
+case $1 in
+ ubuntu)
+ URL="ftp://ftp.ubuntu.com/ubuntu"
+ DISTS="main multiverse restricted universe"
+ ;;
+ debian)
+ URL="ftp://ftp.debian.org/debian"
+ DISTS="main contrib non-free"
+ ;;
+ *)
+ echo "<distribution> can be either debian or ubuntu"
+ exit 1
+ ;;
+esac
+
for arg in $*
do
echo "Number of source packages in $arg: "
- for dist in main contrib non-free; do
+ for dist in ${DISTS}; do
echo -n " $dist: "
- wget -q -O - ftp://ftp.debian.org/debian/dists/$arg/$dist/source/Sources.gz | zgrep -c '^Package: '
+ wget -q -O - ${URL}/dists/$arg/$dist/source/Sources.gz | zgrep -c '^Package: '
done
done