home · contact · privacy
Better passphrase management.
[config] / all_new_2018 / borg.sh
index ec18029aec81f18bd85fccfd916fa37e84ab25a4..1be74bb13f0730d5366378d7e77f5795bbaf128b 100755 (executable)
@@ -17,13 +17,16 @@ usage() {
 
 read_pw() {
     eval $(ssh-agent)
+    echo "ssh-add"
     ssh-add
-    stty -echo
-    printf "Passphrase: "
-    read password
-    stty echo
-    printf "\n"
-    export BORG_PASSPHRASE="${password}"
+    if [ "${#BORG_PASSPHRASE}" -eq 0 ]; then
+        stty -echo
+        printf "Borg passphrase: "
+        read password
+        stty echo
+        printf "\n"
+        export BORG_PASSPHRASE="${password}"
+    fi
 }
 
 if [ ! -f "${config_file}" ]; then