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 = keyfiles: super.writeShellScript "keyed-gpg" ''
17 keyring=$(${self.coreutils}/bin/mktemp)
18 cleanup() { ${self.coreutils}/bin/rm "$keyring"; }
20 ${homelessGPG} --keyring="$keyring" --import ${self.lib.escapeShellArgs keyfiles}
24 trusted_key_args+=( --trusted-key "$keyid" )
26 ${homelessGPG} --with-colons --show-keys ${self.lib.escapeShellArgs keyfiles} |
27 ${self.gawk}/bin/awk -F: '$1 == "pub" { print $5 }')
29 ${homelessGPG} --keyring="$keyring" "''${trusted_key_args[@]}" "$@"