Skip to content

Commit 71b5784

Browse files
committed
[requested-changes] Improved logging on VPN checksum failure
1 parent c320d25 commit 71b5784

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

images/openwisp_wireguard/update_wireguard.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ mkdir -p $_APPLIED_CONF_DIR
2626
assert_exit_code() {
2727
exit_code=$?
2828
lineno=$(($1 - 1))
29+
if [ ! -z "$2" ]; then
30+
echo $2
31+
fi
2932
if [ "$exit_code" != "0" ]; then
3033
echo "Line $lineno: Command returned non zero exit code: $exit_code"
3134
exit $exit_code
@@ -34,7 +37,7 @@ assert_exit_code() {
3437

3538
check_config() {
3639
_latest_checksum=$($_CURL $_VPN_CHECKSUM_URL)
37-
assert_exit_code $LINENO
40+
assert_exit_code $LINENO "Failed to fetch VPN checksum. Ensure VPN UUID and key are correct."
3841
if [ -f "$_CHECKSUM_FILE" ]; then
3942
_current_checksum=$(cat $_CHECKSUM_FILE)
4043
else
@@ -66,7 +69,7 @@ update_config() {
6669
# for having public configurations
6770
umask 0117
6871
$($_CURL $_VPN_DOWNLOAD_URL >"$_CONF_TAR")
69-
assert_exit_code $LINENO
72+
assert_exit_code $LINENO "Failed to download VPN configuration. Ensure VPN UUID and key are correct."
7073
echo "Configuration downloaded, extracting it..."
7174
tar -zxvf $_CONF_TAR -C $CONF_DIR >/dev/null
7275
assert_exit_code $LINENO

0 commit comments

Comments
 (0)