mirror of
https://github.com/nix-community/home-manager
synced 2024-12-24 02:39:48 +01:00
gpg: fix handling of multiple public keys
When processing `publicKeys` entries, handle entries that contain multiple public keys (i.e. gpg --show-key returns multiple `pub` lines) properly, setting the trust level for each key. PR #2897
This commit is contained in:
parent
8ab155c61f
commit
620ed197f3
1 changed files with 6 additions and 5 deletions
|
@ -109,14 +109,15 @@ let
|
|||
}
|
||||
|
||||
function importTrust() {
|
||||
local keyId trust
|
||||
keyId="$(gpgKeyId "$1")"
|
||||
local keyIds trust
|
||||
IFS='\n' read -ra keyIds <<< "$(gpgKeyId "$1")"
|
||||
trust="$2"
|
||||
if [[ -n $keyId ]] ; then
|
||||
for id in "''${keyIds[@]}" ; do
|
||||
{ echo trust; echo "$trust"; (( trust == 5 )) && echo y; echo quit; } \
|
||||
| ${gpg} --no-tty --command-fd 0 --edit-key "$keyId"
|
||||
fi
|
||||
| ${gpg} --no-tty --command-fd 0 --edit-key "$id"
|
||||
done
|
||||
}
|
||||
|
||||
'';
|
||||
|
||||
keyringFiles = let
|
||||
|
|
Loading…
Reference in a new issue