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= TESTS=
EXPORT_FILENAME= EXPORT_FILENAME=
MASTER_PASSWORD=''
# If this file is present then don't store passwords # If this file is present then don't store passwords
NO_PASSWORD_STORE_FILE=~/.nostore NO_PASSWORD_STORE_FILE=~/.nostore
@ -224,6 +226,10 @@ do
shift shift
EXPORT_FILENAME="${1}" EXPORT_FILENAME="${1}"
;; ;;
--master)
shift
MASTER_PASSWORD="${1}"
;;
-p|--pass|--password|--passphrase) -p|--pass|--password|--passphrase)
shift shift
CURR_PASSWORD="${1}" CURR_PASSWORD="${1}"
@ -244,8 +250,10 @@ fi
get_backup_key_id get_backup_key_id
# Use the backups private key as a symmetric passphrase if [ ${#MASTER_PASSWORD} -eq 0 ]; then
MASTER_PASSWORD=$(gpg -q --armor --export-secret-key $MY_BACKUP_KEY_ID | sed '/---/d' | sed '/Version/d' | sed '/^$/d') # 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 if [ $TESTS ]; then
run_tests run_tests