瀏覽代碼

Optionally specify master password

Bob Mottram 8 年之前
父節點
當前提交
ca7b84be97
共有 1 個檔案被更改,包括 10 行新增2 行删除
  1. 10
    2
      src/freedombone-pass

+ 10
- 2
src/freedombone-pass 查看文件

@@ -51,6 +51,8 @@ CURR_PASSWORD=""
51 51
 TESTS=
52 52
 EXPORT_FILENAME=
53 53
 
54
+MASTER_PASSWORD=''
55
+
54 56
 # If this file is present then don't store passwords
55 57
 NO_PASSWORD_STORE_FILE=~/.nostore
56 58
 
@@ -224,6 +226,10 @@ do
224 226
             shift
225 227
             EXPORT_FILENAME="${1}"
226 228
             ;;
229
+        --master)
230
+            shift
231
+            MASTER_PASSWORD="${1}"
232
+            ;;
227 233
         -p|--pass|--password|--passphrase)
228 234
             shift
229 235
             CURR_PASSWORD="${1}"
@@ -244,8 +250,10 @@ fi
244 250
 
245 251
 get_backup_key_id
246 252
 
247
-# Use the backups private key as a symmetric passphrase
248
-MASTER_PASSWORD=$(gpg -q --armor --export-secret-key $MY_BACKUP_KEY_ID | sed '/---/d' | sed '/Version/d' | sed '/^$/d')
253
+if [ ${#MASTER_PASSWORD} -eq 0 ]; then
254
+    # Use the backups private key as a symmetric passphrase
255
+    MASTER_PASSWORD=$(gpg -q --armor --export-secret-key $MY_BACKUP_KEY_ID | sed '/---/d' | sed '/Version/d' | sed '/^$/d')
256
+fi
249 257
 
250 258
 if [ $TESTS ]; then
251 259
     run_tests