home · contact · privacy
Better passphrase management.
[config] / all_new_2018 / borg.sh
index 2c276bf27b090519709fca4054be43c9430a74d4..1be74bb13f0730d5366378d7e77f5795bbaf128b 100755 (executable)
@@ -19,12 +19,14 @@ read_pw() {
     eval $(ssh-agent)
     echo "ssh-add"
     ssh-add
-    stty -echo
-    printf "Borg 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