From ca7b84be97939415dab38b1afaac65d2233f05d4 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 4 Dec 2016 10:00:30 +0000 Subject: [PATCH] Optionally specify master password --- src/freedombone-pass | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/freedombone-pass b/src/freedombone-pass index febbb33e..ca606537 100755 --- a/src/freedombone-pass +++ b/src/freedombone-pass @@ -51,6 +51,8 @@ CURR_PASSWORD="" TESTS= EXPORT_FILENAME= +MASTER_PASSWORD='' + # If this file is present then don't store passwords NO_PASSWORD_STORE_FILE=~/.nostore @@ -224,6 +226,10 @@ do shift EXPORT_FILENAME="${1}" ;; + --master) + shift + MASTER_PASSWORD="${1}" + ;; -p|--pass|--password|--passphrase) shift CURR_PASSWORD="${1}" @@ -244,8 +250,10 @@ fi get_backup_key_id -# Use the backups private key as a symmetric passphrase -MASTER_PASSWORD=$(gpg -q --armor --export-secret-key $MY_BACKUP_KEY_ID | sed '/---/d' | sed '/Version/d' | sed '/^$/d') +if [ ${#MASTER_PASSWORD} -eq 0 ]; then + # Use the backups private key as a symmetric passphrase + MASTER_PASSWORD=$(gpg -q --armor --export-secret-key $MY_BACKUP_KEY_ID | sed '/---/d' | sed '/Version/d' | sed '/^$/d') +fi if [ $TESTS ]; then run_tests