Blame view

repos/robbyrussell/oh-my-zsh/tools/uninstall.sh 1020 Bytes
ed37aae5b   mj   Squashed 'repos/r...
1
  read -r -p "Are you sure you want to remove Oh My Zsh? [y/N] " confirmation
7378b55de   mj   Squashed 'repos/r...
2
  if [ "$confirmation" != y ] && [ "$confirmation" != Y ]; then
4f87835ba   mj   Squashed 'repos/r...
3
4
    echo "Uninstall cancelled"
    exit
ed37aae5b   mj   Squashed 'repos/r...
5
  fi
093a6c34b   mj   Squashed 'repos/r...
6
  echo "Removing ~/.oh-my-zsh"
7378b55de   mj   Squashed 'repos/r...
7
  if [ -d ~/.oh-my-zsh ]; then
093a6c34b   mj   Squashed 'repos/r...
8
9
10
11
    rm -rf ~/.oh-my-zsh
  fi
  
  echo "Looking for original zsh config..."
7378b55de   mj   Squashed 'repos/r...
12
  if [ -f ~/.zshrc.pre-oh-my-zsh ] || [ -h ~/.zshrc.pre-oh-my-zsh ]; then
093a6c34b   mj   Squashed 'repos/r...
13
    echo "Found ~/.zshrc.pre-oh-my-zsh -- Restoring to ~/.zshrc";
7378b55de   mj   Squashed 'repos/r...
14
15
    if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then
      ZSHRC_SAVE=".zshrc.omz-uninstalled-$(date +%Y%m%d%H%M%S)";
093a6c34b   mj   Squashed 'repos/r...
16
      echo "Found ~/.zshrc -- Renaming to ~/${ZSHRC_SAVE}";
7378b55de   mj   Squashed 'repos/r...
17
      mv ~/.zshrc ~/"${ZSHRC_SAVE}";
093a6c34b   mj   Squashed 'repos/r...
18
19
20
    fi
  
    mv ~/.zshrc.pre-oh-my-zsh ~/.zshrc;
7378b55de   mj   Squashed 'repos/r...
21
    echo "Your original zsh config was restored. Please restart your session."
093a6c34b   mj   Squashed 'repos/r...
22
  else
7378b55de   mj   Squashed 'repos/r...
23
    if hash chsh >/dev/null 2>&1; then
ed37aae5b   mj   Squashed 'repos/r...
24
25
26
27
28
      echo "Switching back to bash"
      chsh -s /bin/bash
    else
      echo "You can edit /etc/passwd to switch your default shell back to bash"
    fi
093a6c34b   mj   Squashed 'repos/r...
29
30
31
  fi
  
  echo "Thanks for trying out Oh My Zsh. It's been uninstalled."