Added check for already existent gpg keys. Fixes #12

This commit is contained in:
Diego Lendoiro 2017-06-01 13:16:50 +02:00
parent c47f595e9e
commit a618645950
1 changed files with 4 additions and 1 deletions

View File

@ -29,8 +29,11 @@ EOF" -ls /bin/bash nginx
}
gpg_import_key() {
su -m -c "$gpg --batch --import $gpg_private_key" -ls /bin/bash nginx
local key_id=$(su -m -c "gpg --with-colons $gpg_private_key | grep sec |cut -f5 -d:" -ls /bin/bash nginx)
su -m -c "$gpg --batch --import $gpg_public_key" -ls /bin/bash nginx
su -m -c "gpg -K $key_id" -ls /bin/bash nginx || su -m -c "$gpg --batch --import $gpg_private_key" -ls /bin/bash nginx
}
core_setup() {