2019-03-11 19:00:03 +01:00
|
|
|
#!/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)}"
|
|
|
|
|
2021-10-24 01:07:39 +02:00
|
|
|
if [ ! -d "${destination}" ]; then
|
|
|
|
echo "${destination} does not exist. Creating it..."
|
|
|
|
mkdir -p "${destination}"
|
2019-03-11 19:00:03 +01:00
|
|
|
fi
|
|
|
|
|
2021-10-24 01:07:39 +02:00
|
|
|
gpg --armor --export >"${destination}/public.asc"
|
|
|
|
gpg --armor --export-secret-keys >"${destination}/secret.asc"
|
|
|
|
gpg --armor --export-ownertrust >"${destination}/ownertrust.txt"
|
2019-03-11 19:00:03 +01:00
|
|
|
|
2021-10-24 01:07:39 +02:00
|
|
|
zip -r "${destination}.zip" "${destination}"
|
|
|
|
rm -rf "${destination}"
|
|
|
|
|
|
|
|
echo $(realpath "${destination}.zip")
|