From ce81ed540e75b1991cb3815512e694ea3aee95e7 Mon Sep 17 00:00:00 2001 From: Philipp Schmitt Date: Tue, 1 Sep 2015 12:02:32 +0200 Subject: [PATCH] Fail loudly when unable to retrieve the ovpn files --- pia-tools | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pia-tools b/pia-tools index 62c50fd..75750b1 100755 --- a/pia-tools +++ b/pia-tools @@ -243,11 +243,16 @@ update_config() { echo -n 'Updating configuration... ' local ovpn ovpn_spaceless overwrite=$([[ -n "$FORCE" ]] && echo '-o') + # Fetch server config files + curl -sL -o "$PIA_CONFIG_DIR/openvpn.zip" "$PIA_CONFIG_URL" || { + echo 'Could not download openvpn config files' + exit 4 + } + # Clean up rm -f "$PIA_CONFIG_DIR/ca.crt" "$PIA_CONFIG_DIR"/*.ovpn - # Fetch server config files - curl -sL -o "$PIA_CONFIG_DIR/openvpn.zip" "$PIA_CONFIG_URL" + # Extract config files unzip "$overwrite" -d "$PIA_CONFIG_DIR" -q "$PIA_CONFIG_DIR/openvpn.zip" # Replace space by underscore in filenames