805427e06bc0549c7b9a4f50d3e39bbf68043f16

Author
Marc Cornellà <hello@mcornella.com>
Committer
Marc Cornellà <hello@mcornella.com>
Date

Message

fix(updater): give priority to `zstyle` settings if set (#10587)

Fixes #10587

Diff

 1diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh
 2index 293f48edff7cadbc0c213d27675b03f43fbc7a1c..729d8ecb5bc131946acd6e548f7f68dc5b2ab1c4 100644
 3--- a/tools/check_for_upgrade.sh
 4+++ b/tools/check_for_upgrade.sh
 5@@ -10,11 +10,13 @@ fi
 6 # - auto: the update is performed automatically when it's time
 7 # - reminder: a reminder is shown to the user when it's time to update
 8 # - disabled: automatic update is turned off
 9-zstyle -s ':omz:update' mode update_mode || update_mode=prompt
10+zstyle -s ':omz:update' mode update_mode || {
11+  update_mode=prompt
12 
13-# Support old-style settings
14-[[ "$DISABLE_UPDATE_PROMPT" != true ]] || update_mode=auto
15-[[ "$DISABLE_AUTO_UPDATE" != true ]] || update_mode=disabled
16+  # If the mode zstyle setting is not set, support old-style settings
17+  [[ "$DISABLE_UPDATE_PROMPT" != true ]] || update_mode=auto
18+  [[ "$DISABLE_AUTO_UPDATE" != true ]] || update_mode=disabled
19+}
20 
21 # Cancel update if:
22 # - the automatic update is disabled.