diff options
Diffstat (limited to 'share')
-rwxr-xr-x | share/hydra/import-key | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/share/hydra/import-key b/share/hydra/import-key index a6204f2..c1b141c 100755 --- a/share/hydra/import-key +++ b/share/hydra/import-key @@ -22,19 +22,25 @@ fi # Deploy for node in $NODES; do + hostname="`echo $node | cut -d . -f 1`" + key_id="`keyringer $HYDRA decrypt $hostname/gpg/key 2> /dev/null | gpg --with-colons | grep sec | cut -d : -f 5`" + + if [ -z "$key_id" ]; then + echo "Could not find key for $node, skipping." + continue + fi + echo "" echo "-----------------------------" echo "Importing gpg key to $node..." echo "-----------------------------" echo "" - hostname="`echo $node | cut -d . -f 1`" keyringer $HYDRA decrypt $hostname/gpg/key | $HYDRA_CONNECT $node sudo gpg --homedir /root/.gnupg --import - # TODO: get the full keyid echo "" echo "Trusting key at $node..." echo "" - printf "trust\n5\ny\nsave\n" | $HYDRA_CONNECT $node sudo gpg --homedir /root/.gnupg --no-tty --status-fd=2 --command-fd=0 --edit-key root@$node + printf "trust\n5\ny\nsave\n" | $HYDRA_CONNECT $node sudo gpg --homedir /root/.gnupg --no-tty --status-fd=2 --command-fd=0 --edit-key $key_id echo "" echo "Verifying..." |