From eb37844857acbb6365a77c5f79029708866fa7f8 Mon Sep 17 00:00:00 2001 From: Eric Nielsen <4120606+ericbn@users.noreply.github.com> Date: Tue, 18 Jun 2024 17:40:12 -0500 Subject: [PATCH] Disable background version check if no write access to zimfw.zsh or if it's a symlink or not a regular file. It does not make sense to show a message to user saying "Run zimfw upgrade to upgrade" if the action will then fail. --- src/stage2/80_zimfw.zsh.erb | 4 +++- zimfw.zsh | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/stage2/80_zimfw.zsh.erb b/src/stage2/80_zimfw.zsh.erb index d10e1e3..9bdff90 100644 --- a/src/stage2/80_zimfw.zsh.erb +++ b/src/stage2/80_zimfw.zsh.erb @@ -46,7 +46,9 @@ Options: esac fi - if ! zstyle -t ':zim' disable-version-check && [[ ${1} != check-version ]]; then + if ! zstyle -t ':zim' disable-version-check && \ + [[ ${1} != check-version && -w ${__ZIMFW_PATH} && ! -L ${__ZIMFW_PATH}/zimfw.zsh && -f ${__ZIMFW_PATH}/zimfw.zsh ]] + then # If .latest_version does not exist or was not modified in the last 30 days [[ -f ${_zversion_target}(#qNm-30) ]]; local -r zversion_check_force=${?} _zimfw_check_version ${zversion_check_force} 1 diff --git a/zimfw.zsh b/zimfw.zsh index 3694438..133c122 100644 --- a/zimfw.zsh +++ b/zimfw.zsh @@ -462,7 +462,7 @@ _zimfw_compile() { } _zimfw_info() { - print -R 'zimfw version: '${_zversion}' (built at 2024-06-18 22:08:02 UTC, previous commit is 897afc9)' + print -R 'zimfw version: '${_zversion}' (built at 2024-06-18 22:39:30 UTC, previous commit is 3e812ed)' local zparam for zparam in LANG ${(Mk)parameters:#LC_*} OSTYPE TERM TERM_PROGRAM TERM_PROGRAM_VERSION ZIM_HOME ZSH_VERSION; do print -R ${(r.22....:.)zparam}${(P)zparam} @@ -943,7 +943,9 @@ Options: esac fi - if ! zstyle -t ':zim' disable-version-check && [[ ${1} != check-version ]]; then + if ! zstyle -t ':zim' disable-version-check && \ + [[ ${1} != check-version && -w ${__ZIMFW_PATH} && ! -L ${__ZIMFW_PATH}/zimfw.zsh && -f ${__ZIMFW_PATH}/zimfw.zsh ]] + then # If .latest_version does not exist or was not modified in the last 30 days [[ -f ${_zversion_target}(#qNm-30) ]]; local -r zversion_check_force=${?} _zimfw_check_version ${zversion_check_force} 1