post release updates
[gpg4win.git] / packages / download.sh
index c291c78..fce72b1 100644 (file)
 #    file gnupg/gnupg-1.4.2.tar.gz.sig
 #    
 
+force=no
+if [ "$1" = "--force" ]; then
+    force=yes
+    shift
+fi
+
 WGET=wget
 
-${WGET} -N ftp://ftp.gpw4win.org/gpg4win/packages.current{,.sig}
+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
@@ -66,10 +77,15 @@ while read key value ; do
            exit 1
        fi
        url="$server/$value"
-       echo "downloading \`$url'."
-       if ! ${WGET} -c -q "$url" ; then
-           echo "download of \`$url' failed." >&2
-           echo "$url" >> '.#download.failed'
+       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
        ;;
      *)