Add helper to transmit GPG keys
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
9fa8cd626c
commit
0dac488327
1 changed files with 27 additions and 0 deletions
27
bin/backup_gpg
Executable file
27
bin/backup_gpg
Executable file
|
@ -0,0 +1,27 @@
|
|||
#!/bin/bash
|
||||
|
||||
case $1 in
|
||||
|
||||
backup)
|
||||
# Backup the trustdb
|
||||
gpg2 --export-ownertrust > .gnupg/trustdb.txt
|
||||
|
||||
# Compile the archive
|
||||
tar -cvjf - .gnupg/private-keys-v1.d .gnupg/pubring.gpg .gnupg/trustdb.gpg .gnupg/trustdb.txt | gpg2 --output ${HOME}/gnupg_backup.asc --symmetric --armor
|
||||
;;
|
||||
|
||||
restore)
|
||||
|
||||
# Restore the archive
|
||||
gpg2 --decrypt ${HOME}/gnupg_backup.asc | tar -xvj
|
||||
|
||||
# Restore the owner-trust
|
||||
gpg2 --import-ownertrust < .gnupg/trustdb.txt
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Call me like this: $0 <backup | restore>"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
esac
|
Loading…
Add table
Reference in a new issue