From 9590b96b3f0dc8e2f4a87b632ff59eab28a0081e Mon Sep 17 00:00:00 2001 From: Adam Luikart Date: Mon, 6 Feb 2012 12:22:07 -0600 Subject: Write the update file even if `CLOBBER` is unset. --- tools/check_for_upgrade.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools/check_for_upgrade.sh') diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index 0f8c9c391..5c8ce3a50 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -5,7 +5,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() { -- cgit v1.2.3-70-g09d2 From 8d976e02b1da43ec74c1ca6f50584eed566ff73a Mon Sep 17 00:00:00 2001 From: Mark Feltner Date: Tue, 14 Jan 2014 23:13:49 -0600 Subject: fix(tools/check_for_upgrade): Don't source profile Reverts #2296, but mostly #1883. There is no need to source ~/.profile when this script is read. oh-my-zsh writes no configuration data in ~/.profile. If the user wishes to use data within ~/.profile, then they should source it in another place. Fixes #2315 --- tools/check_for_upgrade.sh | 2 -- 1 file changed, 2 deletions(-) (limited to 'tools/check_for_upgrade.sh') diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index 5c8ce3a50..c5fd0cce1 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -20,8 +20,6 @@ if [[ -z "$epoch_target" ]]; then epoch_target=13 fi -[ -f ~/.profile ] && source ~/.profile - if [ -f ~/.zsh-update ] then . ~/.zsh-update -- cgit v1.2.3-70-g09d2 From a9e1d9aa890c18ea3c3250442e7d9de555633237 Mon Sep 17 00:00:00 2001 From: "n.st" Date: Wed, 4 Jun 2014 19:26:46 +0200 Subject: Cancel upgrade if $ZSH is not writable from #2360 --- tools/check_for_upgrade.sh | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tools/check_for_upgrade.sh') diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index c5fd0cce1..8b8ecae03 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -20,6 +20,12 @@ if [[ -z "$epoch_target" ]]; then epoch_target=13 fi +[ -f ~/.profile ] && source ~/.profile + +# Cancel upgrade if the current user doesn't have write permissions for the +# oh-my-zsh directory. +[[ -w "$ZSH" ]] || return 0 + if [ -f ~/.zsh-update ] then . ~/.zsh-update -- cgit v1.2.3-70-g09d2 From 5e328e3a9c0784521ae4170f7958183c352bae83 Mon Sep 17 00:00:00 2001 From: Moinak Ghosh Date: Fri, 11 Jul 2014 18:41:49 +0530 Subject: Solaris portability tweaks. --- lib/completion.zsh | 7 ++++++- oh-my-zsh.sh | 1 + plugins/colored-man/colored-man.plugin.zsh | 21 +++++++++++++++++++++ tools/check_for_upgrade.sh | 8 +++++++- 4 files changed, 35 insertions(+), 2 deletions(-) (limited to 'tools/check_for_upgrade.sh') diff --git a/lib/completion.zsh b/lib/completion.zsh index fa1d97f48..faea36118 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -25,7 +25,12 @@ bindkey -M menuselect '^o' accept-and-infer-next-history zstyle ':completion:*:*:*:*:*' menu select zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' -zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w" +if [ "$PLAT" = "SunOS" ] +then + zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm" +else + zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w" +fi # disable named-directories autocompletion zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index c217b91bb..4683c2bc0 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -1,3 +1,4 @@ +PLAT=`uname -s` # Check for updates on initial load... if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then /usr/bin/env ZSH=$ZSH DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f $ZSH/tools/check_for_upgrade.sh diff --git a/plugins/colored-man/colored-man.plugin.zsh b/plugins/colored-man/colored-man.plugin.zsh index 56056284a..4956f4346 100644 --- a/plugins/colored-man/colored-man.plugin.zsh +++ b/plugins/colored-man/colored-man.plugin.zsh @@ -1,3 +1,21 @@ +if [ "${PLAT}" = "SunOS" ] +then + if [ ! -x ${HOME}/bin/nroff ] + then + mkdir -p ${HOME}/bin + cat > ${HOME}/bin/nroff < Date: Wed, 20 Aug 2014 23:52:05 +0200 Subject: Replace /usr/bin/env with env Some environments (such as Android) does not have /usr/bin. --- lib/functions.zsh | 4 ++-- oh-my-zsh.sh | 2 +- tools/check_for_upgrade.sh | 2 +- tools/install.sh | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'tools/check_for_upgrade.sh') diff --git a/lib/functions.zsh b/lib/functions.zsh index fda84a953..17f5f9cbf 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -3,11 +3,11 @@ function zsh_stats() { } function uninstall_oh_my_zsh() { - /usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/uninstall.sh + env ZSH=$ZSH /bin/sh $ZSH/tools/uninstall.sh } function upgrade_oh_my_zsh() { - /usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh + env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh } function take() { diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index c217b91bb..a90b3e98a 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -1,6 +1,6 @@ # Check for updates on initial load... if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then - /usr/bin/env ZSH=$ZSH DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f $ZSH/tools/check_for_upgrade.sh + env ZSH=$ZSH DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f $ZSH/tools/check_for_upgrade.sh fi # Initializes Oh My Zsh diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index 8b8ecae03..35e074297 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -9,7 +9,7 @@ function _update_zsh_update() { } function _upgrade_zsh() { - /usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh + env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh # update the zsh file _update_zsh_update } diff --git a/tools/install.sh b/tools/install.sh index fc7ad70cf..7efab10b9 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -10,7 +10,7 @@ if [ -d "$ZSH" ]; then fi echo "\033[0;34mCloning Oh My Zsh...\033[0m" -hash git >/dev/null 2>&1 && /usr/bin/env git clone https://github.com/robbyrussell/oh-my-zsh.git $ZSH || { +hash git >/dev/null 2>&1 && env git clone https://github.com/robbyrussell/oh-my-zsh.git $ZSH || { echo "git not installed" exit } @@ -43,5 +43,5 @@ echo "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m echo "\033[0;32m"' /____/ ....is now installed!'"\033[0m" echo "\n\n \033[0;32mPlease look over the ~/.zshrc file to select plugins, themes, and options.\033[0m" echo "\n\n \033[0;32mp.s. Follow us at http://twitter.com/ohmyzsh.\033[0m" -/usr/bin/env zsh +env zsh . ~/.zshrc -- cgit v1.2.3-70-g09d2 From 5f38a537cef0d79c9d53c01e8f88d150e985c70a Mon Sep 17 00:00:00 2001 From: Moinak Ghosh Date: Tue, 16 Sep 2014 22:29:52 +0530 Subject: Update Solaris changes to use OSTYPE and zsh datetime module. --- lib/completion.zsh | 2 +- oh-my-zsh.sh | 1 - plugins/colored-man/colored-man.plugin.zsh | 2 +- tools/check_for_upgrade.sh | 12 ++++-------- 4 files changed, 6 insertions(+), 11 deletions(-) (limited to 'tools/check_for_upgrade.sh') diff --git a/lib/completion.zsh b/lib/completion.zsh index faea36118..83b6efb66 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -25,7 +25,7 @@ bindkey -M menuselect '^o' accept-and-infer-next-history zstyle ':completion:*:*:*:*:*' menu select zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' -if [ "$PLAT" = "SunOS" ] +if [ "$OSTYPE[0,7]" = "solaris" ] then zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm" else diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 4683c2bc0..c217b91bb 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -1,4 +1,3 @@ -PLAT=`uname -s` # Check for updates on initial load... if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then /usr/bin/env ZSH=$ZSH DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f $ZSH/tools/check_for_upgrade.sh diff --git a/plugins/colored-man/colored-man.plugin.zsh b/plugins/colored-man/colored-man.plugin.zsh index 4956f4346..5c613f49d 100644 --- a/plugins/colored-man/colored-man.plugin.zsh +++ b/plugins/colored-man/colored-man.plugin.zsh @@ -1,4 +1,4 @@ -if [ "${PLAT}" = "SunOS" ] +if [ "$OSTYPE[0,7]" = "solaris" ] then if [ ! -x ${HOME}/bin/nroff ] then diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index 1aba9a272..0e8845ab4 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -1,13 +1,9 @@ -#!/bin/sh +#!/usr/bin/env zsh + +zmodload zsh/datetime -PLAT=`uname -s` function _current_epoch() { - if [ "$PLAT" = "SunOS" ] - then - echo $(($(perl -e 'print time') / 60 / 60 / 24)) - else - echo $(($(date +%s) / 60 / 60 / 24)) - fi + echo $EPOCHSECONDS } function _update_zsh_update() { -- cgit v1.2.3-70-g09d2 From 90762eee49efcdfd6b92ad5d5d9e5f43d113ae0b Mon Sep 17 00:00:00 2001 From: Moinak Ghosh Date: Wed, 17 Sep 2014 11:11:48 +0530 Subject: Convert epoch_target from days to seconds. --- tools/check_for_upgrade.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tools/check_for_upgrade.sh') diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index 0e8845ab4..f49bb151f 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -22,6 +22,8 @@ if [[ -z "$epoch_target" ]]; then epoch_target=13 fi +epoch_target_seconds=$((epoch_target * 86400)) + [ -f ~/.profile ] && source ~/.profile # Cancel upgrade if the current user doesn't have write permissions for the @@ -37,7 +39,7 @@ then fi epoch_diff=$(($(_current_epoch) - $LAST_EPOCH)) - if [ $epoch_diff -gt $epoch_target ] + if [ $epoch_diff -gt $epoch_target_seconds ] then if [ "$DISABLE_UPDATE_PROMPT" = "true" ] then -- cgit v1.2.3-70-g09d2 From 3a3973284534c318e2cb987a0db1121302d04e10 Mon Sep 17 00:00:00 2001 From: Moinak Ghosh Date: Tue, 14 Oct 2014 12:05:01 +0530 Subject: Change to epoch target in days instead of seconds. --- tools/check_for_upgrade.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'tools/check_for_upgrade.sh') diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index f49bb151f..a8ba4820c 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -3,7 +3,7 @@ zmodload zsh/datetime function _current_epoch() { - echo $EPOCHSECONDS + echo $(( $EPOCHSECONDS / 60 / 60 / 24 )) } function _update_zsh_update() { @@ -22,8 +22,6 @@ if [[ -z "$epoch_target" ]]; then epoch_target=13 fi -epoch_target_seconds=$((epoch_target * 86400)) - [ -f ~/.profile ] && source ~/.profile # Cancel upgrade if the current user doesn't have write permissions for the @@ -39,7 +37,7 @@ then fi epoch_diff=$(($(_current_epoch) - $LAST_EPOCH)) - if [ $epoch_diff -gt $epoch_target_seconds ] + if [ $epoch_diff -gt $epoch_target ] then if [ "$DISABLE_UPDATE_PROMPT" = "true" ] then -- cgit v1.2.3-70-g09d2 From 83553597a1430e2f3459de74de1cf33ae4ce67be Mon Sep 17 00:00:00 2001 From: Mark Feltner Date: Tue, 14 Jan 2014 23:13:49 -0600 Subject: fix(tools/check_for_upgrade): Don't source profile Reverts #2296, but mostly #1883. There is no need to source ~/.profile when this script is read. oh-my-zsh writes no configuration data in ~/.profile. If the user wishes to use data within ~/.profile, then they should source it in another place. Fixes #2315 --- tools/check_for_upgrade.sh | 2 -- 1 file changed, 2 deletions(-) (limited to 'tools/check_for_upgrade.sh') diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index 4a0803210..b2b356e0c 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -22,8 +22,6 @@ if [[ -z "$epoch_target" ]]; then epoch_target=13 fi -[ -f ~/.profile ] && source ~/.profile - # Cancel upgrade if the current user doesn't have write permissions for the # oh-my-zsh directory. [[ -w "$ZSH" ]] || return 0 -- cgit v1.2.3-70-g09d2 From 6a1b8320fe9f087179c9ebf092bd17a782127d96 Mon Sep 17 00:00:00 2001 From: HeroCC Date: Mon, 20 Apr 2015 11:24:05 -0400 Subject: No input for Update Check defaults to Yes --- tools/check_for_upgrade.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'tools/check_for_upgrade.sh') diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index b2b356e0c..5afd83c1e 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -41,10 +41,9 @@ then then _upgrade_zsh else - echo "[Oh My Zsh] Would you like to check for updates?" - echo "Type Y to update oh-my-zsh: \c" + echo "[Oh My Zsh] Would you like to check for updates? [Y/n]: \c" read line - if [ "$line" = Y ] || [ "$line" = y ]; then + if [ "$line" = Y ] || [ "$line" = y ] || [ -z "$line" ]; then _upgrade_zsh else _update_zsh_update -- cgit v1.2.3-70-g09d2