mirror of
https://git.decapod.one/brethil/dotfiles
synced 2024-11-24 20:41:31 +01:00
updater: fix it
This commit is contained in:
parent
bbf4c325b8
commit
98604c6a4c
|
@ -1,6 +1,9 @@
|
|||
# vim:ft=zsh ts=2 sw=2 sts=2
|
||||
# Check for update, set DISABLE_UPDATE_PROMPT=yes to disable the prompt and automatically update
|
||||
env DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f "$DOTFILES/check_for_update.sh"
|
||||
|
||||
# Check for update, set DISABLE_UPDATE_PROMPT=true to disable the prompt and automatically update
|
||||
if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then
|
||||
source "${DOTFILES}/check_for_update.sh"
|
||||
fi
|
||||
|
||||
# theme-related variables
|
||||
export ZSH_CUSTOM="$DOTFILES"
|
||||
|
|
|
@ -4,18 +4,17 @@
|
|||
# First version: 14 July 2017
|
||||
# Rebased on upstream: 08 December 2020
|
||||
|
||||
|
||||
local DOTFILES_UPDATEFILE=${DOTFILES}/.dotfiles-update
|
||||
# Migrate .dotfiles-update file to $DOTFILES
|
||||
if [[ -f ~/.dotfiles-update && ! -f "${DOTFILES}/.dotfiles-update" ]]; then
|
||||
mv ~/.dotfiles-update "${DOTFILES}/.dotfiles-update"
|
||||
if [[ -f ~/.dotfiles-update && ! -f "${DOTFILES_UPDATEFILE}" ]]; then
|
||||
mv ~/.dotfiles-update "${DOTFILES_UPDATEFILE}"
|
||||
fi
|
||||
|
||||
# Cancel update if:
|
||||
# - the automatic update is disabled.
|
||||
# - the current user doesn't have write permissions nor owns the $ZSH directory.
|
||||
# - git is unavailable on the system.
|
||||
if [[ "$DISABLE_AUTO_UPDATE" = true ]] \
|
||||
|| [[ ! -w "$ZSH" || ! -O "$ZSH" ]] \
|
||||
|| ! command -v git &>/dev/null; then
|
||||
if [[ "$DISABLE_DOTFILES_AUTOUPDATE" = true ]] || ! command -v git &>/dev/null; then
|
||||
return
|
||||
fi
|
||||
|
||||
|
@ -66,7 +65,7 @@ function update_dotfiles() {
|
|||
" EXIT INT QUIT
|
||||
|
||||
# Create or update .zsh-update file if missing or malformed
|
||||
if ! source "~/.dotfiles-update" 2>/dev/null || [[ -z "$LAST_EPOCH" ]]; then
|
||||
if ! source "${DOTFILES_UPDATEFILE}" 2>/dev/null || [[ -z "$LAST_EPOCH" ]]; then
|
||||
_update_dotfiles_update
|
||||
return
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue
Block a user