about summary refs log tree commit diff
path: root/users/wpcarro/configs/.gnupg/export.sh
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2021-10-23T23·07-0700
committerwpcarro <wpcarro@gmail.com>2022-01-08T05·53+0000
commita415bdaeb542b09d821fe9c9bee7906071f41a25 (patch)
tree2a3d538398964fde2286692bb62d56444530920c /users/wpcarro/configs/.gnupg/export.sh
parentfad38387af3b6a5ed0d8f3042e2ac0a6ceabf45a (diff)
feat(wpcarro/gpg): Zip output from configs/.gnupg/export.sh r/3549
This makes it easier to `scp` to the new host.

Change-Id: If746a71204c97255547b579252622005b4d13b20
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4793
Tested-by: BuildkiteCI
Reviewed-by: wpcarro <wpcarro@gmail.com>
Autosubmit: wpcarro <wpcarro@gmail.com>
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")