about summary refs log tree commit diff
path: root/users/wpcarro/configs/.gnupg/export.sh
diff options
context:
space:
mode:
Diffstat (limited to 'users/wpcarro/configs/.gnupg/export.sh')
-rwxr-xr-xusers/wpcarro/configs/.gnupg/export.sh17
1 files changed, 10 insertions, 7 deletions
diff --git a/users/wpcarro/configs/.gnupg/export.sh b/users/wpcarro/configs/.gnupg/export.sh
index 571689773b0e..bb047e9e3b91 100755
--- a/users/wpcarro/configs/.gnupg/export.sh
+++ b/users/wpcarro/configs/.gnupg/export.sh
@@ -9,13 +9,16 @@ set -e
 
 destination="${1:-$(mktemp -d)}"
 
-if [ ! -d "$destination" ]; then
-  echo "$destination does not exist. Creating it..."
-  mkdir -p "$destination"
+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"
+gpg --armor --export >"${destination}/public.asc"
+gpg --armor --export-secret-keys >"${destination}/secret.asc"
+gpg --armor --export-ownertrust >"${destination}/ownertrust.txt"
 
-echo $(realpath "$destination")
+zip -r "${destination}.zip" "${destination}"
+rm -rf "${destination}"
+
+echo $(realpath "${destination}.zip")