1
0
Fork 0
mirror of https://github.com/Mic92/sops-nix.git synced 2025-03-16 21:48:15 +00:00
sops-nix/pkgs/sops-install-secrets/test-secrets/sops-edit

18 lines
489 B
Text
Raw Normal View History

2020-07-06 07:30:09 +01:00
#!/usr/bin/env nix-shell
#! nix-shell -p gnupg -p bash -p sops -i bash
if [ "$#" -lt 1 ]; then
echo "USAGE: $0 file"
exit 1
fi
set -x
export GNUPGHOME=$(mktemp -d)
trap "gpgconf --kill gpg-agent && rm -rf $GNUPGHOME" EXIT
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
gpg --import "$DIR/key.asc"
gpg --fingerprint --list-keys
fpr=$(gpg --with-fingerprint --with-colons --show-key ./key.asc | awk -F: '$1 == "fpr" { print $10;}')
sops --pgp "$fpr" "$@"