mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-05-08 04:34:00 +02:00
Merge 9407fad1f4 into 291e96dcd0
This commit is contained in:
commit
4417e7b7e6
1 changed files with 12 additions and 0 deletions
|
|
@ -10,10 +10,19 @@ function _update_zsh_update() {
|
||||||
echo "LAST_EPOCH=$(_current_epoch)" >! ~/.zsh-update
|
echo "LAST_EPOCH=$(_current_epoch)" >! ~/.zsh-update
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _create_lock() {
|
||||||
|
touch ~/.zsh-update.lock
|
||||||
|
}
|
||||||
|
function _remove_lock() {
|
||||||
|
rm ~/.zsh-update.lock
|
||||||
|
}
|
||||||
|
|
||||||
function _upgrade_zsh() {
|
function _upgrade_zsh() {
|
||||||
|
_create_lock
|
||||||
env ZSH=$ZSH sh $ZSH/tools/upgrade.sh
|
env ZSH=$ZSH sh $ZSH/tools/upgrade.sh
|
||||||
# update the zsh file
|
# update the zsh file
|
||||||
_update_zsh_update
|
_update_zsh_update
|
||||||
|
_remove_lock
|
||||||
}
|
}
|
||||||
|
|
||||||
epoch_target=$UPDATE_ZSH_DAYS
|
epoch_target=$UPDATE_ZSH_DAYS
|
||||||
|
|
@ -22,6 +31,9 @@ if [[ -z "$epoch_target" ]]; then
|
||||||
epoch_target=13
|
epoch_target=13
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Cancel upgrade if upgrade is already in progress
|
||||||
|
[[ ! -f ~/.zsh-update.lock ]] || return 0
|
||||||
|
|
||||||
# Cancel upgrade if the current user doesn't have write permissions for the
|
# Cancel upgrade if the current user doesn't have write permissions for the
|
||||||
# oh-my-zsh directory.
|
# oh-my-zsh directory.
|
||||||
[[ -w "$ZSH" ]] || return 0
|
[[ -w "$ZSH" ]] || return 0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue