[Nm-templates-discuss] templates keycheck.sh,1.14,1.15

he at haydn.debian.org he at haydn.debian.org
Wed Sep 7 09:52:12 UTC 2005


Update of /cvsroot/nm-templates/templates
In directory haydn:/tmp/cvs-serv10982

Modified Files:
	keycheck.sh 
Log Message:
Also allow 0xKEYID as first argument.


Index: keycheck.sh
===================================================================
RCS file: /cvsroot/nm-templates/templates/keycheck.sh,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- keycheck.sh	31 Jul 2005 16:36:08 -0000	1.14
+++ keycheck.sh	7 Sep 2005 09:52:09 -0000	1.15
@@ -11,13 +11,15 @@
 # You should either have a ~/debian/ or change the path below.
 #
 # Usage:
-# give it at least one option, the keyid (without the 0x).
+# give it at least one option, the keyid.
 # if you want you can give another option, it is passed unchecked to the 
 # first two invocations of gpg
 
 # Always exit if there is an error
 set -e
 
+KEYID=`echo $1 | sed -e 's/^0x//'`
+
 # For the rsync of the debian keyrings and for the nm.gpg
 DESTDIR=~/debian
 # Which keyserver
@@ -36,11 +38,11 @@
 echo "Syncing Debian Keyrings with rsync from keyring.debian.org"
 rsync -qcltz --block-size=8192 --partial --progress --exclude='emeritus-*' --exclude='removed-*' 'keyring.debian.org::keyrings/keyrings/*' $DESTDIR/.
 echo "Receiving and checking key"
-gpg $2 ${GPGOPTS} --keyserver=$KEYSERVER --recv-keys 0x$1
-gpg $2 ${GPGOPTS} -v --with-fingerprint --keyring $DESTDIR/debian-keyring.gpg --keyring $DESTDIR/debian-keyring.pgp --check-sigs $1
+gpg $2 ${GPGOPTS} --keyserver=$KEYSERVER --recv-keys 0x$KEYID
+gpg $2 ${GPGOPTS} -v --with-fingerprint --keyring $DESTDIR/debian-keyring.gpg --keyring $DESTDIR/debian-keyring.pgp --check-sigs $KEYID
 
 echo "Let's test if its a version 4 or greater key"
-VERSION=$(gpg ${GPGOPTS} --with-colons --with-fingerprint --list-keys 0x$1 | awk -F : '$1 == "fpr" {print length($10)}')
+VERSION=$(gpg ${GPGOPTS} --with-colons --with-fingerprint --list-keys 0x$KEYID | awk -F : '$1 == "fpr" {print length($10)}')
 
 if [ $VERSION -eq 32 ]; then
 	echo "Warning: It looks like this key is an Version 3 GPG key. This is bad."
@@ -51,7 +53,7 @@
 fi
 
 echo "Check for key expire stuff"
-EXPIRE=$(gpg ${GPGOPTS} --with-colons --check-sigs $1 |awk -F : ' $1 == "sub" && $2 != "r" {print $7} ')
+EXPIRE=$(gpg ${GPGOPTS} --with-colons --check-sigs 0x$KEYID |awk -F : ' $1 == "sub" && $2 != "r" {print $7} ')
 
 if [ -z $EXPIRE ]; then
     echo "Key has no expiration date set, nothing to check."




More information about the Nm-templates-discuss mailing list