summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgpg-safe-import10
1 files changed, 10 insertions, 0 deletions
diff --git a/gpg-safe-import b/gpg-safe-import
new file mode 100755
index 0000000..eca63c2
--- /dev/null
+++ b/gpg-safe-import
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+tmp_dir=$(mktemp -d)
+trap 'rm -rf --one-file-system "${tmp_dir}"' EXIT
+
+if ! gpg --homedir "${tmp_dir}" "$@"; then
+ >&2 echo 'gpg exited non-zero'
+ exit 1
+fi
+gpg --homedir "${tmp_dir}" -a --export | gpg --import