From 73fbea12315008b6adb4640b9bfde4b360a7b35b Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Thu, 4 Jul 2019 11:40:11 +0200 Subject: Skip update if no internet Requested-by: Sultan Alsawaf --- fetch.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fetch.sh b/fetch.sh index 9730f2e..b071b2e 100644 --- a/fetch.sh +++ b/fetch.sh @@ -6,6 +6,8 @@ exec 9>.wireguard-fetch-lock flock -n 9 || exit 0 [[ $(( $(date +%s) - $(stat -c %Y "net/wireguard/.check" 2>/dev/null || echo 0) )) -gt 86400 ]] || exit 0 +[[ $(( $(date +%s) - $(stat -c %Y "net/wireguard/.noconnectivity" 2>/dev/null || echo 0) )) -gt 5 ]] || exit 0 +ping -w 2 -4 -c 1 build.wireguard.com >/dev/null 2>&1 || { touch "net/wireguard/.noconnectivity"; echo "No internet detected, skipping WireGuard update." >&2; exit 0; } while read -r distro package version _; do if [[ $distro == upstream && $package == kmodtools ]]; then -- cgit v1.2.3-59-g8ed1b