dotfiles

config files and scripts at HOME.
git clone git://git.ricketyspace.net/dotfiles.git
Log | Files | Refs

commit bff7079a9d2f6c8eda867d7dfacd245842e4069f
parent 6b32a4ee6eb199fed5bf0da09d0f06c10dfdf025
Author: rsiddharth <rsiddharth@ninthfloor.org>
Date:   Tue, 31 May 2016 20:21:35 +0000

update .bin/gnupg-backup

encryption is optional.

Diffstat:
.bin/gnupg-backup | 15++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/.bin/gnupg-backup b/.bin/gnupg-backup @@ -73,13 +73,15 @@ def encrypt_it(f): OPT_SYM_ENCRYPT, f))) -def gnupg_export(fpr, directory): +def gnupg_export(fpr, directory, encrypt=False): """Export gnupg data connected with fingerprint `fpr` to `directory`. This function will create directory call `gnupg-fpr` inside `directory` and export gnupg data connected with fingerprint `fpr` to 3 seperate files under `gnupg-fpr`. + If `encrypt` is True, then encrypt the whole export. + """ # Remove spaces from fingerprint @@ -120,12 +122,13 @@ def gnupg_export(fpr, directory): # Create a tar ball of the export_dir. tar_ball = tar_it(export_dir) - # Encrypt the tar ball. - encrypt_it(tar_ball) + # If asked for, encrypt the tar ball. + if encrypt: + encrypt_it(tar_ball) + os.remove(tar_ball) # Clean up. rmtree(export_dir) - os.remove(tar_ball) if __name__ == "__main__": @@ -135,10 +138,12 @@ if __name__ == "__main__": help="fingerprint of key to export.") group.add_argument('directory', help="directory to export to") + group.add_argument('-e', '--encrypt', action="store_true", + help="encrypt the export.") args = parser.parse_args() directory = path.expanduser(args.directory) if path.exists(directory): - gnupg_export(args.fpr, directory) + gnupg_export(args.fpr, directory, args.encrypt) else: print "%s does not exist. Exiting..." % (directory)