summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-07-19 11:37:43 +0200
committerErich Eckner <git@eckner.net>2019-07-19 11:37:43 +0200
commit9cc9a3954adafb6c907303468cc4a96d5fbb8925 (patch)
tree2b1921cc142d9a608158106b48bc4a55a599e6c7
downloadgpg-safe-import-9cc9a3954adafb6c907303468cc4a96d5fbb8925.tar.xz
initial commit
-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