summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/check_for_upgrade.sh43
-rwxr-xr-xtools/install.sh16
-rwxr-xr-xtools/theme_chooser.sh2
-rw-r--r--tools/upgrade.sh2
4 files changed, 31 insertions, 32 deletions
diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh
index bd9aba8be..05b31e8d4 100644
--- a/tools/check_for_upgrade.sh
+++ b/tools/check_for_upgrade.sh
@@ -7,7 +7,7 @@ function _current_epoch() {
}
function _update_zsh_update() {
- echo "LAST_EPOCH=$(_current_epoch)" >! ~/.zsh-update
+ echo "LAST_EPOCH=$(_current_epoch)" >! ${ZSH_CACHE_DIR}/.zsh-update
}
function _upgrade_zsh() {
@@ -29,31 +29,32 @@ fi
# Cancel upgrade if git is unavailable on the system
whence git >/dev/null || return 0
-if [ -f ~/.zsh-update ]
-then
- . ~/.zsh-update
+if mkdir "$ZSH/log/update.lock" 2>/dev/null; then
+ if [ -f ${ZSH_CACHE_DIR}/.zsh-update ]; then
+ . ${ZSH_CACHE_DIR}/.zsh-update
- if [[ -z "$LAST_EPOCH" ]]; then
- _update_zsh_update && return 0;
- fi
+ if [[ -z "$LAST_EPOCH" ]]; then
+ _update_zsh_update && return 0
+ fi
- epoch_diff=$(($(_current_epoch) - $LAST_EPOCH))
- if [ $epoch_diff -gt $epoch_target ]
- then
- if [ "$DISABLE_UPDATE_PROMPT" = "true" ]
- then
- _upgrade_zsh
- else
- echo "[Oh My Zsh] Would you like to check for updates? [Y/n]: \c"
- read line
- if [[ "$line" == Y* ]] || [[ "$line" == y* ]] || [ -z "$line" ]; then
+ epoch_diff=$(($(_current_epoch) - $LAST_EPOCH))
+ if [ $epoch_diff -gt $epoch_target ]; then
+ if [ "$DISABLE_UPDATE_PROMPT" = "true" ]; then
_upgrade_zsh
else
- _update_zsh_update
+ echo "[Oh My Zsh] Would you like to update? [Y/n]: \c"
+ read line
+ if [[ "$line" == Y* ]] || [[ "$line" == y* ]] || [ -z "$line" ]; then
+ _upgrade_zsh
+ else
+ _update_zsh_update
+ fi
fi
fi
+ else
+ # create the zsh file
+ _update_zsh_update
fi
-else
- # create the zsh file
- _update_zsh_update
+
+ rmdir $ZSH/log/update.lock
fi
diff --git a/tools/install.sh b/tools/install.sh
index 3f4de8681..0cc020053 100755
--- a/tools/install.sh
+++ b/tools/install.sh
@@ -24,12 +24,10 @@ main() {
# which may fail on systems lacking tput or terminfo
set -e
- CHECK_ZSH_INSTALLED=$(grep /zsh$ /etc/shells | wc -l)
- if [ ! $CHECK_ZSH_INSTALLED -ge 1 ]; then
+ if ! command -v zsh >/dev/null 2>&1; then
printf "${YELLOW}Zsh is not installed!${NORMAL} Please install zsh first!\n"
exit
fi
- unset CHECK_ZSH_INSTALLED
if [ ! -n "$ZSH" ]; then
ZSH=~/.oh-my-zsh
@@ -49,7 +47,7 @@ main() {
umask g-w,o-w
printf "${BLUE}Cloning Oh My Zsh...${NORMAL}\n"
- hash git >/dev/null 2>&1 || {
+ command -v git >/dev/null 2>&1 || {
echo "Error: git is not installed"
exit 1
}
@@ -61,7 +59,7 @@ main() {
exit 1
fi
fi
- env git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git $ZSH || {
+ env git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git "$ZSH" || {
printf "Error: git clone of oh-my-zsh repo failed\n"
exit 1
}
@@ -74,9 +72,9 @@ main() {
fi
printf "${BLUE}Using the Oh My Zsh template file and adding it to ~/.zshrc${NORMAL}\n"
- cp $ZSH/templates/zshrc.zsh-template ~/.zshrc
+ cp "$ZSH"/templates/zshrc.zsh-template ~/.zshrc
sed "/^export ZSH=/ c\\
- export ZSH=$ZSH
+ export ZSH=\"$ZSH\"
" ~/.zshrc > ~/.zshrc-omztemp
mv -f ~/.zshrc-omztemp ~/.zshrc
@@ -107,10 +105,10 @@ main() {
echo ''
echo 'p.s. Follow us at https://twitter.com/ohmyzsh.'
echo ''
- echo 'p.p.s. Get stickers and t-shirts at http://shop.planetargon.com.'
+ echo 'p.p.s. Get stickers and t-shirts at https://shop.planetargon.com.'
echo ''
printf "${NORMAL}"
- env zsh
+ env zsh -l
}
main
diff --git a/tools/theme_chooser.sh b/tools/theme_chooser.sh
index 2c2a379ba..82ae5857c 100755
--- a/tools/theme_chooser.sh
+++ b/tools/theme_chooser.sh
@@ -5,7 +5,7 @@
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
-# http://sam.zoy.org/wtfpl/COPYING for more details.
+# http://www.wtfpl.net/txt/copying/ for more details.
THEMES_DIR="$ZSH/themes"
FAVLIST="${HOME}/.zsh_favlist"
diff --git a/tools/upgrade.sh b/tools/upgrade.sh
index d5e7e8ba8..25b2de27a 100644
--- a/tools/upgrade.sh
+++ b/tools/upgrade.sh
@@ -33,7 +33,7 @@ then
printf '%s\n' ' /____/ '
printf "${BLUE}%s\n" "Hooray! Oh My Zsh has been updated and/or is at the current version."
printf "${BLUE}${BOLD}%s${NORMAL}\n" "To keep up on the latest news and updates, follow us on twitter: https://twitter.com/ohmyzsh"
- printf "${BLUE}${BOLD}%s${NORMAL}\n" "Get your Oh My Zsh swag at: http://shop.planetargon.com/"
+ printf "${BLUE}${BOLD}%s${NORMAL}\n" "Get your Oh My Zsh swag at: https://shop.planetargon.com/"
else
printf "${RED}%s${NORMAL}\n" 'There was an error updating. Try again later?'
fi