about summary refs log tree commit diff
path: root/users/wpcarro/configs/.gnupg/import.sh
diff options
context:
space:
mode:
Diffstat (limited to 'users/wpcarro/configs/.gnupg/import.sh')
-rwxr-xr-xusers/wpcarro/configs/.gnupg/import.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/users/wpcarro/configs/.gnupg/import.sh b/users/wpcarro/configs/.gnupg/import.sh
new file mode 100755
index 000000000000..bb449267ce5e
--- /dev/null
+++ b/users/wpcarro/configs/.gnupg/import.sh
@@ -0,0 +1,28 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+# Run this script to import all of the information exported by `export.sh`.
+# Usage: ./import.sh path/to/export.zip
+
+if [ -z "${1+x}" ]; then
+  echo "You must specify the path to export.zip. Exiting..."
+  exit 1
+fi
+
+destination="$(mktemp -d)"
+
+function cleanup() {
+  rm -rf "${destination}"
+}
+trap cleanup EXIT
+
+unzip "${1}" -d "${destination}" >/dev/null
+
+gpg --import "${destination}/public.asc"
+gpg --import "${destination}/secret.asc"
+gpg --import-ownertrust "${destination}/ownertrust.txt"
+
+# Run this at the end to output some verification
+gpg --list-keys
+gpg --list-secret-keys