- can't figure out how to parse escaped colons in gpg --with-colons
authorMark Huang <mlhuang@cs.princeton.edu>
Thu, 18 May 2006 17:34:10 +0000 (17:34 +0000)
committerMark Huang <mlhuang@cs.princeton.edu>
Thu, 18 May 2006 17:34:10 +0000 (17:34 +0000)
  output. sigh. just blindly add the uid when updating, gpg will detect
  2+ duplicates and it doesn't really matter anyway.

plc.d/gpg

index 00b37bb..48c643e 100755 (executable)
--- a/plc.d/gpg
+++ b/plc.d/gpg
@@ -7,7 +7,7 @@
 # Mark Huang <mlhuang@cs.princeton.edu>
 # Copyright (C) 2006 The Trustees of Princeton University
 #
-# $Id: gpg,v 1.4 2006/05/17 20:47:59 mlhuang Exp $
+# $Id: gpg,v 1.5 2006/05/17 22:52:09 mlhuang Exp $
 #
 
 # Source function library and configuration
@@ -58,8 +58,6 @@ EOF
            while read -a fields ; do
                if [ "${fields[0]}" = "pub" ] ; then
                    fingerprint=${fields[4]}
-                   IFS=$OLDIFS
-                   comment=${fields[9]/\x3a/:}
                    break
                fi
            done < <(
@@ -69,18 +67,16 @@ EOF
            )
            IFS=$OLDIFS
 
-           # Add a new UID if appropriate
-           if [ "$comment" != "$PLC_NAME Central (http://$PLC_WWW_HOST/) <$PLC_MAIL_SUPPORT_ADDRESS>" ] ; then
-               gpg --homedir=/etc/planetlab --no-permission-warning --no-tty --yes \
-                   --command-fd 0 --status-fd 1 --edit-key $fingerprint <<EOF
+           # Add a new UID if appropriate. GPG will detect and merge duplicates.
+           gpg --homedir=/etc/planetlab --no-permission-warning --no-tty --yes \
+               --command-fd 0 --status-fd 1 --edit-key $fingerprint <<EOF
 adduid
 $PLC_NAME Central
 $PLC_MAIL_SUPPORT_ADDRESS
 http://$PLC_WWW_HOST/
 save
 EOF
-               check
-           fi
+           check
        fi
 
        # Install the key in the RPM database