diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-02-28 10:33:54 +0100 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-02-28 10:33:54 +0100 |
commit | 9a145601b331c0077d183e2b8f39c8f69450b452 (patch) | |
tree | 905174bc3618b47a3b93f47e053af936bcd0f0a8 | |
parent | a845f02e612696547fe2981bc987674e8058b419 (diff) |
use sshpass and refactor
-rwxr-xr-x | bin/extra/aivpn | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/bin/extra/aivpn b/bin/extra/aivpn index 3c87ce8..aab90a8 100755 --- a/bin/extra/aivpn +++ b/bin/extra/aivpn @@ -4,27 +4,18 @@ logn() { printf "%s\n" "$@"; } if [ "$1" = "-k" ] then - pgrep -f -- "ssh.*-L.*vm" | - xargs kill + pgrep -f -- "ssh.*-L.*vm" | xargs kill exit fi -# For when script calls itself -if [ "$PASSWORD" ] -then - pass show "$PASSWORD" && - exit - exit 1 -fi - keyadd ehb/ai -export SSH_ASKPASS="$0" +export SSH_ASKPASS="sshpass" export SSH_ASKPASS_REQUIRE="prefer" -export PASSWORD=zot/qemu +export PASSWORD="zot/qemu" logn "I: Waiting for connectivity..." -while ! ssh -o ConnectTimeout=1 -o BatchMode=yes vm 2>&1 | grep -q "Permission denied" +while ! ssh -o ConnectTimeout=1 -o BatchMode=yes vm 2>&1 | grep "Permission denied" > /dev/null do sleep 1 done |