Autocommit of file /home/julien/scripts/count_debian_packages.sh changed on host...
authorJulien Valroff <julien@kirya.net>
Fri, 30 Dec 2011 13:47:21 +0000 (14:47 +0100)
committerJulien Valroff <julien@kirya.net>
Fri, 30 Dec 2011 13:47:21 +0000 (14:47 +0100)
count_debian_packages.sh

index 321f013..4e6778b 100755 (executable)
@@ -1,19 +1,34 @@
 #!/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