1
0
Fork 0
mirror of https://github.com/Mic92/sops-nix.git synced 2024-12-14 11:57:52 +00:00
sops-nix/pkgs/sops-install-secrets/test-assets/sops-edit
2020-07-12 13:50:55 +01:00

19 lines
No EOL
560 B
Text
Executable file

#!/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" "$DIR/ssh-key.asc"
gpg --fingerprint --list-keys
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')
sops --pgp "$fpr" "$@"