Sha256: 70055269a3d511ac3340397022238dfecb3c50bd9f9544fdc377fedfd3761808

Contents?: true

Size: 855 Bytes

Versions: 13

Compression:

Stored size: 855 Bytes

Contents

#!/bin/sh

function _current_epoch() {
  echo $(($(date +%s) / 60 / 60 / 24))
}

function _update_zsh_update() {
  echo "LAST_EPOCH=$(_current_epoch)" > ~/.zsh-update
}

function _upgrade_zsh() {
  /usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh
  # update the zsh file
  _update_zsh_update
}

if [ -f ~/.zsh-update ]
then
  . ~/.zsh-update

  if [[ -z "$LAST_EPOCH" ]]; then
    _update_zsh_update && return 0;
  fi

  epoch_diff=$(($(_current_epoch) - $LAST_EPOCH))
  if [ $epoch_diff -gt 6 ]
  then
    if [ "$DISABLE_UPDATE_PROMPT" = "true" ]
    then
      _upgrade_zsh
    else
      echo "Would you like to check for updates to DOTS?"
      echo "Type Y to update ~/.dots: \c"
      read line
      if [ "$line" = Y ] || [ "$line" = y ]
      then
        _upgrade_zsh
      fi
    fi
  fi
else
  # create the zsh file
  _update_zsh_update
fi

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
zsh_dots-0.6.5 vendor/oh-my-zsh/check_for_upgrade.sh
zsh_dots-0.6.3 vendor/oh-my-zsh/check_for_upgrade.sh
zsh_dots-0.6.2 vendor/oh-my-zsh/check_for_upgrade.sh
zsh_dots-0.6.0 vendor/oh-my-zsh/check_for_upgrade.sh
zsh_dots-0.5.9 vendor/oh-my-zsh/check_for_upgrade.sh
zsh_dots-0.5.8 vendor/oh-my-zsh/check_for_upgrade.sh
zsh_dots-0.5.7 vendor/oh-my-zsh/check_for_upgrade.sh
zsh_dots-0.5.6 vendor/oh-my-zsh/check_for_upgrade.sh
zsh_dots-0.5.5 vendor/oh-my-zsh/check_for_upgrade.sh
zsh_dots-0.5.4 vendor/oh-my-zsh/check_for_upgrade.sh
zsh_dots-0.5.3 vendor/oh-my-zsh/check_for_upgrade.sh
zsh_dots-0.5.1 vendor/oh-my-zsh/check_for_upgrade.sh
zsh_dots-0.5.0 vendor/oh-my-zsh/check_for_upgrade.sh