post release updates
[gpg4win.git] / packages / download.sh
index 8cfaf1b..fce72b1 100644 (file)
@@ -1,70 +1,99 @@
-#! /bin/sh
-
-. ../include/config.sh
-
-
-# GNU
-
-server_gnu=ftp://ftp.cs.tu-berlin.de/pub/gnu
-
-${WGET} -c ${server_gnu}/gettext/gettext-runtime-0.13.1.bin.woe32.zip
-${WGET} -c ${server_gnu}/gettext/gettext-runtime-0.13.1.bin.woe32.zip.sig
-${WGET} -c ${server_gnu}/gettext/gettext-0.13.1.tar.gz
-${WGET} -c ${server_gnu}/gettext/gettext-0.13.1.tar.gz.sig
-
-${WGET} -c ${server_gnu}/libiconv/libiconv-1.9.1.bin.woe32.zip
-${WGET} -c ${server_gnu}/libiconv/libiconv-1.9.1.bin.woe32.zip.sig
-${WGET} -c ${server_gnu}/libiconv/libiconv-1.9.1.tar.gz
-# No signature for the source package.
-
-
-# http://gnuwin32.sourceforge.net/
-
-server_gnuwin32=http://mesh.dl.sourceforge.net/sourceforge/gnuwin32
-
-${WGET} -c ${server_gnuwin32}/zlib-1.2.3-bin.zip
-${WGET} -c ${server_gnuwin32}/zlib-1.2.3-lib.zip
-${WGET} -c ${server_gnuwin32}/zlib-1.2.3-src.zip
-
-${WGET} -c ${server_gnuwin32}/libpng-1.2.8-bin.zip
-${WGET} -c ${server_gnuwin32}/libpng-1.2.8-lib.zip
-${WGET} -c ${server_gnuwin32}/libpng-1.2.8-src.zip
-
-
-# http://www.gimp.org/~tml/gimp/win32/downloads.html
-
-server_gtk=ftp://ftp.gtk.org/pub/gtk/v2.6
-server_gimp=http://www.gimp.org/~tml/gimp/win32
-
-${WGET} -c ${server_gtk}/win32/glib-2.6.6.zip
-${WGET} -c ${server_gtk}/win32/glib-dev-2.6.6.zip
-${WGET} -c ${server_gtk}/glib-2.6.6.tar.bz2
-
-${WGET} -c ${server_gtk}/win32/atk-1.9.0.zip
-${WGET} -c ${server_gtk}/win32/atk-dev-1.9.0.zip
-${WGET} -c ${server_gtk}/atk-1.9.0.tar.bz2
-
-${WGET} -c ${server_gtk}/win32/pango-1.8.2.zip
-${WGET} -c ${server_gtk}/win32/pango-dev-1.8.2.zip
-${WGET} -c ${server_gtk}/pango-1.8.2.tar.bz2
-
-${WGET} -c ${server_gtk}/win32/gtk+-2.6.9.zip
-${WGET} -c ${server_gtk}/win32/gtk+-dev-2.6.9.zip
-${WGET} -c ${server_gtk}/gtk+-2.6.6.tar.bz2
-
-${WGET} -c ${server_gimp}/pkgconfig-0.15.zip
-${WGET} -c ${server_gimp}/pkgconfig-0.15.0.tar.gz
-
-
-# GnuPG stuff.
-
-server_gnupg=http://ftp.gnupg.org/gcrypt
-
-${WGET} -c ${server_gnupg}/gnupg/gnupg-1.4.2.tar.gz
-${WGET} -c ${server_gnupg}/gnupg/gnupg-1.4.2.tar.gz.sig
-
-${WGET} -c ${server_gnupg}/gpgme/gpgme-1.1.0.tar.gz
-${WGET} -c ${server_gnupg}/gpgme/gpgme-1.1.0.tar.gz.sig
-
-# libgpg-error, GPA and GPGol currently come from manually crafted
-# packages.
+#!/bin/sh
+# download.sh - Download source and binary packages for GPG4Win.
+# Copyright (C) 2005 g10 Code GmbH
+# 
+# This file is part of GPG4Win.
+# 
+# GPG4Win is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# 
+# GPG4Win is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+
+# Syntax of the packages.current file:
+#
+# If the first non whitespace character of a line is #, the line is
+# considered a comment.  If the first word of a line is "server", the
+# rest of the line will be taken as the base URL for following file
+# commands.  If the first word of a line is "file" the rest of the
+# line will be appended to the current base URL (with a / as
+# delimiter).  Example:
+#
+#    # GnuPG stuff. 
+#    server ftp://ftp.gnupg.org/gcrypt
+#    
+#    file gnupg/gnupg-1.4.2.tar.gz
+#    file gnupg/gnupg-1.4.2.tar.gz.sig
+#    
+
+force=no
+if [ "$1" = "--force" ]; then
+    force=yes
+    shift
+fi
+
+WGET=wget
+
+url="ftp://ftp.gpg4win.org/gpg4win/"
+echo "downloading packages list from \`$url'."
+if ! ${WGET} -N -q $url/packages.current{,.sig} ; then
+    echo "download of packages list failed." >&2
+    exit 1
+fi
+
+if ! gpgv --keyring ./packages.keys packages.current.sig packages.current
+  then
+    echo "list of packages is not usable." >&2
+    exit 1
+fi
+
+
+lnr=0
+[ -f '.#download.failed' ] && rm '.#download.failed'
+cat packages.current | \
+while read key value ; do
+    (( lnr++ ))
+    [ -z "$key" ] && continue
+    case "$key" in
+     \#*)    ;;
+    server) 
+       server="$value" 
+       ;;
+    file)
+       if [ -z "$value" ]; then
+           echo "syntax error in file statement" >&2
+           exit 1
+       fi
+       if [ -z "$server" ]; then
+           echo "no server location available for file \`$value'" >&2
+           exit 1
+       fi
+       url="$server/$value"
+       name=`basename "$value"`
+       if [ -f "$name" -a "$force" = "no" ]; then
+           echo "package     \`$url' already exists."
+       else
+           echo "downloading \`$url'."
+           if ! ${WGET} -c -q "$url" ; then
+               echo "download of \`$url' failed." >&2
+               echo "$url" >> '.#download.failed'
+           fi
+       fi
+       ;;
+     *)
+       echo "syntax error in packages.current, line $lnr." >&2
+       exit 1
+     esac
+done
+if [ -f '.#download.failed' ]; then
+  echo "some files failed to download" 2>&1
+  exit 1
+fi