Optionally specify master password

This commit is contained in:
Bob Mottram 2016-12-04 10:00:30 +00:00
parent 807d6055bf
commit ca7b84be97
1 changed files with 10 additions and 2 deletions

View File

@ -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