Skip site navigation (1)Skip section navigation (2)
Date:      22 Jan 2002 10:47:33 +0100
From:      Dag-Erling Smorgrav <des@ofug.org>
To:        Murray Stokely <murray@freebsd.org>
Cc:        Jun Kuriyama <kuriyama@FreeBSD.org>, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: doc/en_US.ISO8859-1/books/handbook/pgpkeys chapter.sgml
Message-ID:  <xzp665ura2y.fsf@flood.ping.uio.no>
In-Reply-To: <xzpk7uarb6x.fsf@flood.ping.uio.no>
References:  <200201211616.g0LGGFH54977@freefall.freebsd.org> <xzpg04zs9m9.fsf@flood.ping.uio.no> <20020122054120.GT21973@freebsdmall.com> <xzpk7uarb6x.fsf@flood.ping.uio.no>

next in thread | previous in thread | raw e-mail | index | archive | help
--=-=-=

Here's a better patch - it handles users with multiple keys, including
all keys that match the id(s) specified on the command line (or
${me}@freebsd.org), and ${me} defaults to $(id -nu).

DES
-- 
Dag-Erling Smorgrav - des@ofug.org


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=pgpkeys.diff

Index: book.sgml
===================================================================
RCS file: /home/ncvs/doc/en_US.ISO8859-1/books/handbook/book.sgml,v
retrieving revision 1.120
diff -u -r1.120 book.sgml
--- book.sgml	1 Jan 2002 09:43:37 -0000	1.120
+++ book.sgml	22 Jan 2002 09:04:24 -0000
@@ -50,6 +50,7 @@
 <!ENTITY % chap.pgpkeys "IGNORE">
 <!ENTITY % chap.index "IGNORE">
 
+<!ENTITY % pgpkeys SYSTEM "pgpkeys/pgpkeys.ent"> %pgpkeys;
 ]>
 
 <book>
Index: pgpkeys/addkey.sh
===================================================================
RCS file: pgpkeys/addkey.sh
diff -N pgpkeys/addkey.sh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ pgpkeys/addkey.sh	22 Jan 2002 09:46:22 -0000
@@ -0,0 +1,75 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+me="$1"
+if [ -z "${me}" ]; then
+    me=$(id -nu)
+else
+    shift
+fi
+
+id="$@"
+if [ -z "${id}" ]; then
+    id="${me}@freebsd.org"
+fi
+
+gpg=$(which gpg)
+
+
+
+if [ ! -x "${gpg}" ]; then
+    echo "GnuPG does not seem to be installed" >/dev/stderr
+    exit 1
+fi
+
+echo "Retrieving key..."
+keylist=$(gpg --list-keys ${id})
+id=$(echo "${keylist}" | awk '/^pub/ { print $2 }' | sed 's%.*/%%')
+if [ "${#id}" -lt 8 ]; then
+    echo "Invalid key ID." >/dev/stderr
+    exit 1
+elif [ "${#id}" -gt 8 ]; then
+    echo "WARNING: Multiple keys; exporting all.  If this is not what you want," >/dev/stderr
+    echo "WARNING: you should specify a key ID on the command line." >/dev/stderr
+fi
+fp=$(gpg --fingerprint ${id})
+[ $? -eq 0 ] || exit 1
+tmp=$(echo ${id} | sed 's/[[:<:]]/--export /')
+key=$(gpg --armor ${tmp})
+[ $? -eq 0 ] || exit 1
+
+keyfile="${me}.key"
+echo "Generating ${keyfile}..."
+(
+    echo '<!-- $FreeBSD$ -->'
+    echo '<!-- Key id:' "${id}" '-->'
+    echo '<programlisting><![CDATA['
+    echo "${fp}"
+    echo ']]></programlisting>'
+    echo '<programlisting role="pgpkey"><![CDATA['
+    echo "${key}"
+    echo ']]></programlisting>'
+) >"${keyfile}"
+
+echo "Adding key to entity list..."
+mv pgpkeys.ent pgpkeys.ent.orig || exit 1
+(
+    cat pgpkeys.ent.orig
+    printf '<!ENTITY pgpkey.%.*s SYSTEM "%s">' 16 "${me}" "${keyfile}"
+) | sort -u >pgpkeys.ent
+
+echo 
+echo "Unless you are already listed there, you should now add the"
+echo "following text to chapter.sgml in the appropriate position in"
+echo "the developer section (unless this is a role key or you are a"
+echo "core member.)  Remember to keep the list sorted by last name!"
+echo 
+echo "    <sect2>"
+echo "      <title>&a.${me};</title>"
+echo "      &pgpkey.${me};"
+echo "    </sect2>"
+echo
+echo "Don't forget to 'cvs add ${keyfile}' if this is a new entry,"
+echo "and check your diffs before committing!"
Index: pgpkeys/pgpkeys.ent
===================================================================
RCS file: pgpkeys/pgpkeys.ent
diff -N pgpkeys/pgpkeys.ent
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ pgpkeys/pgpkeys.ent	22 Jan 2002 09:46:41 -0000
@@ -0,0 +1 @@
+<!-- $FreeBSD$ -->

--=-=-=--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?xzp665ura2y.fsf>