summaryrefslogtreecommitdiff
path: root/config/essentials/shell/functions.sh
diff options
context:
space:
mode:
authorRaymaekers Luca <raymaekers.luca@gmail.com>2024-09-10 17:40:48 +0200
committerRaymaekers Luca <raymaekers.luca@gmail.com>2024-09-10 17:40:48 +0200
commit72db940a51ff4be15a43c42d1ec8ee13888c4230 (patch)
tree8f5a7e55de9efb3862ad3220d17b4e738077620b /config/essentials/shell/functions.sh
parent6616f6b0b973a2cf1a26ebd1c0f7d28620fb3116 (diff)
checkpoint
Diffstat (limited to 'config/essentials/shell/functions.sh')
-rw-r--r--config/essentials/shell/functions.sh13
1 files changed, 7 insertions, 6 deletions
diff --git a/config/essentials/shell/functions.sh b/config/essentials/shell/functions.sh
index 464126b..fd2226d 100644
--- a/config/essentials/shell/functions.sh
+++ b/config/essentials/shell/functions.sh
@@ -168,18 +168,19 @@ function git_develop_branch() {
}
# gpg backup
+# $1: key
gpg_backup()
{
- # $1: option
- # $2: output file (without .asc)
- gpg_command() { gpg "$1" --armor > "$2".asc; }
- gpg_command --export-secret-keys "private"
- gpg_command --export "public"
- gpg_command --export-ownertrust "trust"
+ key="$(gpg --list-keys --with-colons | awk -F: '/^uid/ {print $10}' |sort|uniq | fzf)"
+ [ "$key" ] || exit 1
+ gpg --armor --export-secret-keys "$key" > private.asc
+ gpg --armor --export "$key" > public.asc
+ gpg --armor --export-ownertrust > trust.asc
tar -czvf gpg_backup.tar.gz public.asc private.asc trust.asc
shred -uz public.asc private.asc trust.asc
}
+# $1: backup tar
gpg_import()
{
tar xf $1