[Lunar-commits] CVS: theedge/var/lib/lunar/functions sources.lunar, 1.19, 1.20

Auke Kok sofar at lunar-linux.org
Fri Aug 27 08:18:35 GMT 2004


Update of /var/cvs/lunar/theedge/var/lib/lunar/functions
In directory dbguin.lunar-linux.org:/tmp/cvs-serv1654

Modified Files:
	sources.lunar 
Log Message:
Adding sha1: verify syntax code that uses sha1sum, slightly better than md5sum (what is it again, 160 bits against 128 hash size?). The code hooks up seamlessly and as demonstrated the older core doesn't break if it doesn't handle the sha1: syntax. sha1sum is provided by coreutils BTW so must in any case be present on all boxes, I don't expect any box to fail on that.


Index: sources.lunar
===================================================================
RCS file: /var/cvs/lunar/theedge/var/lib/lunar/functions/sources.lunar,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- sources.lunar	21 May 2004 10:27:13 -0000	1.19
+++ sources.lunar	27 Aug 2004 08:18:33 -0000	1.20
@@ -88,7 +88,20 @@
     verbose_msg "should be md5sum: $2"
     return 1
   fi
+}
+
 
+# function : md5_verify_source
+# usage    : md5_verify_source filename md5
+# purpose  : md5 verifies a filename
+sha1_verify_source() {
+  debug_msg "sha1_verify_source ($@)"
+  TMP_SHA1=$(sha1sum $SOURCE_CACHE/$1 | cut -d " " -f 1-1)
+  if [ "$2" != "$TMP_SHA1" ] ; then
+    verbose_msg "offending sha1sum: $TMP_SHA1"
+    verbose_msg "should be sha1sum: $2"
+    return 1
+  fi
 }
 
 
@@ -213,6 +226,11 @@
 	    message "${PROBLEM_COLOR}! md5sum check failed for ${DEFAULT_COLOR}${FILE_COLOR}$SRC1${DEFAULT_COLOR}"
 	    RESULT=1
 	  fi
+	elif [ "${VFY:0:5}" == "sha1:" ] ; then
+	  if ! sha1_verify_source $SRC1 $(echo $VFY | cut -d: -f2) ; then
+	    message "${PROBLEM_COLOR}! sha1sum check failed for ${DEFAULT_COLOR}${FILE_COLOR}$SRC1${DEFAULT_COLOR}"
+	    RESULT=1
+	  fi
 	elif [ "${VFY:0:4}" == "gpg:" ] ; then
 	  if ! gpg_verify_source $SRC1 $(echo $VFY | cut -d: -f2- | cut -f1) $(echo $VFY | cut d: -f2- | cut -f2) $(echo $VFY | cut -d: -f2- | cut -f3) ; then
 	    message "${PROBLEM_COLOR}! gpg signature check failed for ${DEFAULT_COLOR}${FILE_COLOR}$SRC1${DEFAULT_COLOR}"



More information about the Lunar-commits mailing list