diff options
author | William Carroll <wpcarro@gmail.com> | 2019-03-11T18·00+0000 |
---|---|---|
committer | William Carroll <wpcarro@gmail.com> | 2019-03-11T18·00+0000 |
commit | eaf42b68c25e9bfdb2e5f62f9e9bd460405071d9 (patch) | |
tree | ab1841ec8e4f14245fcc5c9a9d158af0ee39ad61 /configs/shared/gpg/.gnupg/export.sh | |
parent | e774ce5d1c8ddb62fc62c69719390eff1c4f50b0 (diff) |
Better support GPG migrations
After yet another unpleasant experience starting up GPG on a new system, I decided to encode my learnings and mistakes as aliases, functions, scripts, hoping to protect my future me from myself. Fingers crossed!
Diffstat (limited to 'configs/shared/gpg/.gnupg/export.sh')
-rwxr-xr-x | configs/shared/gpg/.gnupg/export.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/configs/shared/gpg/.gnupg/export.sh b/configs/shared/gpg/.gnupg/export.sh new file mode 100755 index 000000000000..571689773b0e --- /dev/null +++ b/configs/shared/gpg/.gnupg/export.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +set -e + +# Run this script to export all the information required to transport your GPG +# information. +# Usage: ./export.sh [directory] +# TODO: run this periodically as a job. + +destination="${1:-$(mktemp -d)}" + +if [ ! -d "$destination" ]; then + echo "$destination does not exist. Creating it..." + mkdir -p "$destination" +fi + +gpg --armor --export >"$destination/public.asc" +gpg --armor --export-secret-keys >"$destination/secret.asc" +gpg --armor --export-ownertrust >"$destination/ownertrust.txt" + +echo $(realpath "$destination") |