aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2018-10-02 15:44:13 +0200
committerFlorian Bruhin <me@the-compiler.org>2018-10-02 15:44:13 +0200
commit5e0f2de332a3b16fe46b5e8b657882cf9fc476b7 (patch)
treea33e8c819d6c3d89e0b861606de4d3ef669cffb7
parent8fe5dcff188deba32c50ede1cc81deb07ba8fc18 (diff)
downloadhsrvpn-master.tar.gz
hsrvpn-master.zip
hsrvpn: Add error handlingHEADmaster
-rwxr-xr-xhsrvpn9
1 files changed, 9 insertions, 0 deletions
diff --git a/hsrvpn b/hsrvpn
index a39e790..82220e0 100755
--- a/hsrvpn
+++ b/hsrvpn
@@ -11,7 +11,16 @@ username=$1
host=vpn.hsr.ch
password=$(keyring get openhsr-connect $username)
+if [[ -z "$password" ]]; then
+ echo "No openhsr-connect (HSR) password found!" >&2
+ exit 1
+fi
+
tokens=( $(keyring get hsrvpn-secrets $username) )
+if [[ -z "$tokens" ]]; then
+ echo "No tokens found!" >&2
+ exit 1
+fi
token=${tokens[0]}
unset -v 'tokens[0]'