X-Git-Url: https://plomlompom.com/repos/foo.html?a=blobdiff_plain;ds=sidebyside;f=all_new_2018%2Fborg.sh;h=18321b15fa949256cc3cd13077e6002ef73cee52;hb=17489120d557d9af614693ff6ee60a904ede4629;hp=2c276bf27b090519709fca4054be43c9430a74d4;hpb=78e690e37dc3b86b5563697268c07da7baae4ae3;p=config
diff --git a/all_new_2018/borg.sh b/all_new_2018/borg.sh
index 2c276bf..18321b1 100755
--- a/all_new_2018/borg.sh
+++ b/all_new_2018/borg.sh
@@ -16,15 +16,21 @@ usage() {
}
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 [ "${#SSH_AGENT_PID}" -eq 0 ]; then
+ eval $(ssh-agent)
+ echo "ssh-add"
+ stty -echo
+ ssh-add
+ stty echo
+ fi
+ 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