rework sops-pgp-hook and document it.

This commit is contained in:
Jörg Thalheim 2020-07-13 09:51:53 +01:00
parent 6286c5cc75
commit 7c6f438d05
No known key found for this signature in database
GPG key ID: 003F2096411B5F92
4 changed files with 176 additions and 48 deletions

View file

@ -1,23 +0,0 @@
_sopsAddKey() {
@gpg@ --quiet --import "$key"
local fpr
fpr=$(@gpg@ --with-fingerprint --with-colons --show-key "$key" \
| awk -F: '$1 == "fpr" { print $10;}')
export SOPS_PGP_FP=''${SOPS_PGP_FP}''${SOPS_PGP_FP:+','}$fpr
}
sopsShellHook() {
local key dir
for key in $sopsGPGKeys; do
_sopsAddKey "$key"
done
for dir in $sopsGPGKeyDirs; do
while IFS= read -r -d '' key; do
_sopsAddKey "$key"
done < <(find "$dir" -type f -name '*.gpg' -o -name '*.asc' -print0)
done
}
if [ -z "${shellHook-}" ]; then
shellHook=sopsShellHook
fi