]> src.twobees.de Git - dotfiles.git/blob - stow/oh-my-zsh/.oh-my-zsh/tools/uninstall.sh
...
[dotfiles.git] / stow / oh-my-zsh / .oh-my-zsh / tools / uninstall.sh
1 read -r -p "Are you sure you want to remove Oh My Zsh? [y/N] " confirmation
2 if [ "$confirmation" != y ] && [ "$confirmation" != Y ]; then
3   echo "Uninstall cancelled"
4   exit
5 fi
6
7 echo "Removing ~/.oh-my-zsh"
8 if [ -d ~/.oh-my-zsh ]; then
9   rm -rf ~/.oh-my-zsh
10 fi
11
12 if [ -e ~/.zshrc ]; then
13   ZSHRC_SAVE=~/.zshrc.omz-uninstalled-$(date +%Y-%m-%d_%H-%M-%S)
14   echo "Found ~/.zshrc -- Renaming to ${ZSHRC_SAVE}"
15   mv ~/.zshrc "${ZSHRC_SAVE}"
16 fi
17
18 echo "Looking for original zsh config..."
19 ZSHRC_ORIG=~/.zshrc.pre-oh-my-zsh
20 if [ -e "$ZSHRC_ORIG" ]; then
21   echo "Found $ZSHRC_ORIG -- Restoring to ~/.zshrc"
22   mv "$ZSHRC_ORIG" ~/.zshrc
23   echo "Your original zsh config was restored."
24 else
25   echo "No original zsh config found"
26 fi
27
28 if hash chsh >/dev/null 2>&1 && [ -f ~/.shell.pre-oh-my-zsh ]; then
29   old_shell=$(cat ~/.shell.pre-oh-my-zsh)
30   echo "Switching your shell back to '$old_shell':"
31   if chsh -s "$old_shell"; then
32     rm -f ~/.shell.pre-oh-my-zsh
33   else
34     echo "Could not change default shell. Change it manually by running chsh"
35     echo "or editing the /etc/passwd file."
36   fi
37 fi
38
39 echo "Thanks for trying out Oh My Zsh. It's been uninstalled."
40 echo "Don't forget to restart your terminal!"