From f48c36d85ddc27d7c89960b9f388158c148ae905 Mon Sep 17 00:00:00 2001 From: Eric Keller Date: Sat, 2 Sep 2017 17:34:19 +0200 Subject: [PATCH] No internet, skips oh-my-zsh update process There is no need to check for updates when there is no/bad internet connectivity. This commit depends on curl which will try to hit the oh-my-zsh git remote for 3s and skip updates otherwise. --- tools/check_for_upgrade.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index a57f6da0f..21c418e09 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -29,6 +29,12 @@ fi # Cancel upgrade if git is unavailable on the system whence git >/dev/null || return 0 +# Skip when no internet connectivity, depends on curl +REMOTE=$(cd "$ZSH" && git remote get-url --all origin) +# -L follow redirect, -s silent, +# --max-time overall operation timeout, -I only download headers +whence curl > /dev/null && curl -L -s --max-time 3 -I ${REMOTE} || return 0 + if mkdir "$ZSH/log/update.lock" 2>/dev/null; then if [ -f ~/.zsh-update ]; then . ~/.zsh-update