Package: apt-zip
Version: 0.19
Severity: wishlist
Tags: patch

Hello,
I'm attaching a patch to allow wget method for multi-checksums: there are some
repositories that are not using SHA256 checksums, and the script currently
recognizes only that type; with this patch are enabled: sha256, sha1, md5sum.

Tomorrow I'll test at work with a list with sha256 and md5sum, but preliminary
tests confirm it works :)

Cheers,
Sandro

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.22-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages apt-zip depends on:
ii  apt                           0.7.14+b1  Advanced front-end for dpkg

apt-zip recommends no packages.

apt-zip suggests no packages.

-- no debconf information
diff -Nru apt-zip-0.18/apt-zip-list apt-zip-0.19/apt-zip-list
--- apt-zip-0.18/apt-zip-list	2008-02-01 07:57:01.000000000 +0100
+++ apt-zip-0.19/apt-zip-list	2008-08-25 23:45:36.000000000 +0200
@@ -35,7 +35,7 @@
 
 [ -n "$PACKAGES" ] && apt-get ${APTGETEXTRAOPTS} -qq --print-uris install $PACKAGES > "$TMP"
 [ -n "$APTGETACTION" ] && apt-get ${APTGETEXTRAOPTS} -qq --print-uris ${APTGETACTION} >> "$TMP"
-grep $GREP < "$TMP" | tr -d "'" | sed 's/SHA256://' | sort -u > "$TEMP"
+grep $GREP < "$TMP" | tr -d "'" | sort -u > "$TEMP"
 if [ $? != 0 ]
 then
     error "apt-get failed"
diff -Nru apt-zip-0.18/debian/changelog apt-zip-0.19/debian/changelog
diff -Nru apt-zip-0.18/methods/wget apt-zip-0.19/methods/wget
--- apt-zip-0.18/methods/wget	2008-02-01 07:54:37.000000000 +0100
+++ apt-zip-0.19/methods/wget	2008-08-26 00:02:48.000000000 +0200
@@ -33,8 +33,17 @@
 	    [ ! -r "\$1" ] && return 1
 	    [ "\$2" = "0" ] && return \$3
 	    [ "\$2" = "" ] && return \$3
-	    [ "\`type sha256sum\`" ] &&
-	        if [ "\`sha256sum \$1 | cut -d' ' -f1\`" = \$2 ]
+	    type=\$(echo \$2 | cut -d":" -f1)
+	    checksum=\$(echo \$2 | cut -d":" -f2)
+	    case "\$type" in
+	      SHA256) cmd=sha256sum;;
+	      SHA1  ) cmd=sha1sum;;
+	      MD5Sum) cmd=md5sum;;
+	      *     ) err \$1 "(\$type) wrong checksum type"; return 1;;
+	    esac
+
+	    [ "\`type \$cmd\`" ] &&
+	        if [ "\`\$cmd \$1 | cut -d' ' -f1\`" = \$checksum ]
 	        then return 0
 	        else err \$1 "wrong checksum"; return 1
 	        fi

Reply via email to