1
0
Fork 0
mirror of https://github.com/Mic92/sops-nix.git synced 2025-03-16 13:38:20 +00:00
sops-nix/pkgs/sops-install-secrets/test-assets/sops-edit

19 lines
560 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 )"
2020-07-12 13:50:55 +01:00
gpg --import "$DIR/key.asc" "$DIR/ssh-key.asc"
2020-07-06 07:30:09 +01:00
gpg --fingerprint --list-keys
2020-07-12 13:50:55 +01:00
fpr=$(gpg --with-fingerprint --with-colons --show-key "$DIR/key.asc" "$DIR/ssh-key.asc" | awk -F: '$1 == "fpr" { print $10;}' | xargs | sed -e 's/ /,/g')
2020-07-06 07:30:09 +01:00
sops --pgp "$fpr" "$@"