mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-05-22 04:51:12 +02:00
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.
This commit is contained in:
parent
d848c94804
commit
f48c36d85d
1 changed files with 6 additions and 0 deletions
|
|
@ -29,6 +29,12 @@ fi
|
||||||
# Cancel upgrade if git is unavailable on the system
|
# Cancel upgrade if git is unavailable on the system
|
||||||
whence git >/dev/null || return 0
|
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 mkdir "$ZSH/log/update.lock" 2>/dev/null; then
|
||||||
if [ -f ~/.zsh-update ]; then
|
if [ -f ~/.zsh-update ]; then
|
||||||
. ~/.zsh-update
|
. ~/.zsh-update
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue