From 35bdbeb2420d31cfcd4137a3c89e52e8dc74cfbc Mon Sep 17 00:00:00 2001 From: Alexandr Kozlinskiy Date: Fri, 26 Aug 2016 09:52:54 +0200 Subject: [PATCH 1/3] if ZDOTDIR is set, put .zsh-update there --- tools/check_for_upgrade.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index bd9aba8be..64fde3330 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -7,7 +7,7 @@ function _current_epoch() { } function _update_zsh_update() { - echo "LAST_EPOCH=$(_current_epoch)" >! ~/.zsh-update + echo "LAST_EPOCH=$(_current_epoch)" >! ${ZDOTDIR:-${HOME}}/.zsh-update } function _upgrade_zsh() { @@ -29,9 +29,9 @@ fi # Cancel upgrade if git is unavailable on the system whence git >/dev/null || return 0 -if [ -f ~/.zsh-update ] +if [ -f ${ZDOTDIR:-${HOME}}/.zsh-update ] then - . ~/.zsh-update + . ${ZDOTDIR:-${HOME}}/.zsh-update if [[ -z "$LAST_EPOCH" ]]; then _update_zsh_update && return 0; From 8406bb5da53aea76add64f6de245ee498c045dc7 Mon Sep 17 00:00:00 2001 From: Alexandr Kozlinskiy Date: Sat, 27 Aug 2016 15:14:31 +0200 Subject: [PATCH 2/3] store .zsh-update in $ZSH/cache/ --- tools/check_for_upgrade.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index 64fde3330..2ce8368e6 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -1,5 +1,9 @@ #!/usr/bin/env zsh +if [ -z "$ZSH_UPDATE" ]; then + ZSH_UPDATE="$ZSH/cache/.zsh-update" +fi + zmodload zsh/datetime function _current_epoch() { @@ -7,7 +11,7 @@ function _current_epoch() { } function _update_zsh_update() { - echo "LAST_EPOCH=$(_current_epoch)" >! ${ZDOTDIR:-${HOME}}/.zsh-update + echo "LAST_EPOCH=$(_current_epoch)" >! $ZSH_UPDATE } function _upgrade_zsh() { @@ -29,9 +33,9 @@ fi # Cancel upgrade if git is unavailable on the system whence git >/dev/null || return 0 -if [ -f ${ZDOTDIR:-${HOME}}/.zsh-update ] +if [ -f $ZSH_UPDATE ] then - . ${ZDOTDIR:-${HOME}}/.zsh-update + . $ZSH_UPDATE if [[ -z "$LAST_EPOCH" ]]; then _update_zsh_update && return 0; From f42d1a81827ddee7131b4591eacf1a07b5dbb7c7 Mon Sep 17 00:00:00 2001 From: Alexandr Kozlinskiy Date: Mon, 17 Oct 2016 12:13:54 +0200 Subject: [PATCH 3/3] always set $ZSH_UPDATE to $ZSH/cache/.zsh-update --- tools/check_for_upgrade.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index c91fb0433..c31906958 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -1,8 +1,6 @@ #!/usr/bin/env zsh -if [ -z "$ZSH_UPDATE" ]; then - ZSH_UPDATE="$ZSH/cache/.zsh-update" -fi +ZSH_UPDATE="$ZSH/cache/.zsh-update" zmodload zsh/datetime @@ -11,7 +9,7 @@ function _current_epoch() { } function _update_zsh_update() { - echo "LAST_EPOCH=$(_current_epoch)" >! $ZSH_UPDATE + echo "LAST_EPOCH=$(_current_epoch)" >! "$ZSH_UPDATE" } function _upgrade_zsh() { @@ -34,8 +32,8 @@ fi whence git >/dev/null || return 0 if mkdir "$ZSH/log/update.lock" 2>/dev/null; then - if [ -f $ZSH_UPDATE ]; then - . $ZSH_UPDATE + if [ -f "$ZSH_UPDATE" ]; then + . "$ZSH_UPDATE" if [[ -z "$LAST_EPOCH" ]]; then _update_zsh_update && return 0;