1 # Following the instructions at https://tribut.de/blog/git-commit-signatures-trusted-keys
2 # Use with git with -c gpg.program='keyedgpg /path/to/keyfile.asc'
6 homelessGPG = super.writeShellScript "homeless-gpg" ''
9 export GNUPGHOME=$(${self.coreutils}/bin/mktemp -d)
10 trap '${self.coreutils}/bin/rm -r "$GNUPGHOME"' EXIT
11 ${self.gnupg}/bin/gpg --no-default-keyring "$@"
14 keyedgpg = super.writeShellScript "keyed-gpg" ''
18 echo "usage: keyed-gpg /path/to/keyfile1.asc ... -- gpg-command..." >&2
25 if [[ "$1" == -- ]];then
30 if [[ ! -r "$1" ]];then
40 keyring=$(${self.coreutils}/bin/mktemp)
41 cleanup() { ${self.coreutils}/bin/rm "$keyring"; }
43 ${homelessGPG} --keyring="$keyring" --import "''${keyfiles[@]}"
47 trusted_key_args+=( --trusted-key "$keyid" )
49 ${homelessGPG} --with-colons --show-keys "''${keyfiles[@]}" |
50 ${self.gawk}/bin/awk -F: '$1 == "pub" { print $5 }')
52 ${homelessGPG} --keyring="$keyring" "''${trusted_key_args[@]}" "$@"