]> gitweb.fluxo.info Git - hydra.git/commitdiff
Updates import-keys for gnupg2 compatibility
authorSilvio Rhatto <rhatto@riseup.net>
Sat, 19 Aug 2017 17:06:04 +0000 (14:06 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sat, 19 Aug 2017 17:06:04 +0000 (14:06 -0300)
share/hydra/import-keys

index 9f10e94f0713d237f86954eec2493f7b52bfc513..fe026b62a9912e0e69c35bb2bdc85fa734f464e6 100755 (executable)
@@ -23,7 +23,8 @@ hydra_config_load
 # Import OpenPGP keypair
 function hydra_import_keys_openpgp {
   key="$(keyringer $HYDRA decrypt nodes/$hostname/gpg/key 2> /dev/null | sed -ne '1,$p')"
-  key_id="$(echo "$key" | gpg --with-colons | grep sec | cut -d : -f 5)"
+  pubkey="$(keyringer $HYDRA decrypt nodes/$hostname/gpg/key.pub 2> /dev/null | sed -ne '1,$p')"
+  key_id="$(echo "$pubkey" | gpg --with-colons | grep pub | cut -d : -f 5)"
 
   if [ -z "$key" ]; then
     echo "Could not find key for $node, skipping."
@@ -41,7 +42,7 @@ function hydra_import_keys_openpgp {
     echo "$key" | sudo gpg --homedir /root/.gnupg --import
 
     echo ""
-    echo "Trusting key at $node..."
+    echo "Trusting key $key_id at $node..."
     echo ""
     printf "trust\n5\ny\nsave\n" | sudo gpg --homedir /root/.gnupg --no-tty --status-fd=2 --command-fd=0 --edit-key $key_id
 
@@ -60,7 +61,7 @@ EOF
     echo "$key" | sudo gpg --homedir /root/.gnupg --import
 
     echo ""
-    echo "Trusting key at $node..."
+    echo "Trusting key $key_id at $node..."
     echo ""
     printf "trust\n5\ny\nsave\n" | sudo gpg --homedir /root/.gnupg --no-tty --status-fd=2 --command-fd=0 --edit-key $key_id