summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Cornellà <marc.cornella@live.com>2020-12-07 19:53:07 +0100
committerMarc Cornellà <marc.cornella@live.com>2020-12-07 20:58:12 +0100
commit5a888ff4ac58798ccdff0f32c4609fd153edc217 (patch)
treeae58ed17ad1de0cd9ccccf32fec1edfbe63ecae6
parentfa1911f89eab6d8d753e302546c6ecd5d0db9e08 (diff)
downloadzsh-5a888ff4ac58798ccdff0f32c4609fd153edc217.tar.gz
zsh-5a888ff4ac58798ccdff0f32c4609fd153edc217.tar.bz2
zsh-5a888ff4ac58798ccdff0f32c4609fd153edc217.zip
fix(updater): don't show changelog when running unattended update (#9495)
Fixes #9495
-rw-r--r--lib/cli.zsh8
-rw-r--r--lib/functions.zsh2
-rw-r--r--tools/check_for_upgrade.sh2
-rwxr-xr-xtools/upgrade.sh10
4 files changed, 15 insertions, 7 deletions
diff --git a/lib/cli.zsh b/lib/cli.zsh
index 38cdc449c..92d447a8e 100644
--- a/lib/cli.zsh
+++ b/lib/cli.zsh
@@ -376,13 +376,19 @@ function _omz::theme::use {
function _omz::update {
# Run update script
- env ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh"
+ if [[ "$1" != --unattended ]]; then
+ ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" --interactive
+ else
+ ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh"
+ fi
local ret=$?
+
# Update last updated file
zmodload zsh/datetime
echo "LAST_EPOCH=$(( EPOCHSECONDS / 60 / 60 / 24 ))" >! "${ZSH_CACHE_DIR}/.zsh-update"
# Remove update lock if it exists
command rm -rf "$ZSH/log/update.lock"
+
# Restart the zsh session
if [[ $ret -eq 0 && "$1" != --unattended ]]; then
# Check whether to run a login shell
diff --git a/lib/functions.zsh b/lib/functions.zsh
index b0582b32b..0fc758070 100644
--- a/lib/functions.zsh
+++ b/lib/functions.zsh
@@ -14,7 +14,7 @@ function upgrade_oh_my_zsh() {
fi
# Run update script
- env ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh"
+ env ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" --interactive
local ret=$?
# Update last updated file
zmodload zsh/datetime
diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh
index 17925af8b..d0ceba92d 100644
--- a/tools/check_for_upgrade.sh
+++ b/tools/check_for_upgrade.sh
@@ -24,7 +24,7 @@ function update_last_updated_file() {
}
function update_ohmyzsh() {
- ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh"
+ ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" --interactive
update_last_updated_file
}
diff --git a/tools/upgrade.sh b/tools/upgrade.sh
index 0e4c368bc..cfd424527 100755
--- a/tools/upgrade.sh
+++ b/tools/upgrade.sh
@@ -70,10 +70,12 @@ if git pull --rebase --stat origin master; then
message="Hooray! Oh My Zsh has been updated!"
# Display changelog with less if available, otherwise just print it to the terminal
- if (( $+commands[less] )); then
- "$ZSH/tools/changelog.sh" HEAD "$last_commit" --text | command less -R
- else
- "$ZSH/tools/changelog.sh" HEAD "$last_commit"
+ if [[ "$1" = --interactive ]]; then
+ if (( $+commands[less] )); then
+ "$ZSH/tools/changelog.sh" HEAD "$last_commit" --text | LESS= command less -R
+ else
+ "$ZSH/tools/changelog.sh" HEAD "$last_commit"
+ fi
fi
fi