upgrade.sh 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # Use colors, but only if connected to a terminal, and that terminal
  2. # supports them.
  3. if which tput >/dev/null 2>&1; then
  4. ncolors=$(tput colors)
  5. fi
  6. if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
  7. RED="$(tput setaf 1)"
  8. GREEN="$(tput setaf 2)"
  9. YELLOW="$(tput setaf 3)"
  10. BLUE="$(tput setaf 4)"
  11. BOLD="$(tput bold)"
  12. NORMAL="$(tput sgr0)"
  13. else
  14. RED=""
  15. GREEN=""
  16. YELLOW=""
  17. BLUE=""
  18. BOLD=""
  19. NORMAL=""
  20. fi
  21. cd "$ZSH"
  22. # Set git-config values known to fix git errors
  23. # Line endings (#4069)
  24. git config core.eol lf
  25. git config core.autocrlf false
  26. # zeroPaddedFilemode fsck errors (#4963)
  27. git config fsck.zeroPaddedFilemode ignore
  28. git config fetch.fsck.zeroPaddedFilemode ignore
  29. git config receive.fsck.zeroPaddedFilemode ignore
  30. printf "${BLUE}%s${NORMAL}\n" "Updating Oh My Zsh"
  31. if git pull --rebase --stat origin master
  32. then
  33. printf '%s' "$GREEN"
  34. printf '%s\n' ' __ __ '
  35. printf '%s\n' ' ____ / /_ ____ ___ __ __ ____ _____/ /_ '
  36. printf '%s\n' ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '
  37. printf '%s\n' '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '
  38. printf '%s\n' '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '
  39. printf '%s\n' ' /____/ '
  40. printf "${BLUE}%s\n" "Hooray! Oh My Zsh has been updated and/or is at the current version."
  41. printf "${BLUE}${BOLD}%s${NORMAL}\n" "To keep up on the latest news and updates, follow us on twitter: https://twitter.com/ohmyzsh"
  42. printf "${BLUE}${BOLD}%s${NORMAL}\n" "Get your Oh My Zsh swag at: https://shop.planetargon.com/collections/oh-my-zsh"
  43. else
  44. printf "${RED}%s${NORMAL}\n" 'There was an error updating. Try again later?'
  45. fi