From e1f5c0c703c60d473144f58e1ab49d51c38ab526 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Mon, 31 Aug 2009 15:00:38 -0700 Subject: [PATCH] Adding an uninstaller tool --- README.textile | 4 ++++ functions.zsh | 4 ++++ tools/uninstall.sh | 20 ++++++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 tools/uninstall.sh diff --git a/README.textile b/README.textile index f09feec0e..d7169c394 100644 --- a/README.textile +++ b/README.textile @@ -41,6 +41,10 @@ TODO: Update this.. * Theme support: Change the @ZSH_THEME@ environment variable in @~/.zshrc@. * much much more.. +h3. Uninstalling + +If you want to uninstall it, just run @uninstall_oh_my_zsh@ from the command line and it'll remove itself and revert you to bash (or your previous zsh config). + h2. Thanks * Rick Olsen (technoweenie) might remember some of the configuration, which I took from a pastie a few years ago. diff --git a/functions.zsh b/functions.zsh index 1f2a2023c..2ce91c964 100644 --- a/functions.zsh +++ b/functions.zsh @@ -26,4 +26,8 @@ function remote_console() { function zsh_stats() { history | awk '{print $2}' | sort | uniq -c | sort -rn | head +} + +function uninstall_oh_my_zsh() { + /bin/sh $ZSH/tools/uninstall.sh } \ No newline at end of file diff --git a/tools/uninstall.sh b/tools/uninstall.sh new file mode 100644 index 000000000..8ff583322 --- /dev/null +++ b/tools/uninstall.sh @@ -0,0 +1,20 @@ +echo "Removing ~/.oh-my-zsh" +if [[ -d ~/.oh-my-zsh ]] +then + rm -rf ~/.oh-my-zsh +fi + +echo "Looking for an existing zsh config..." +if [ -f ~/.zshrc.pre-oh-my-zsh ] || [ -h ~/.zshrc.pre-oh-my-zsh ] +then + echo "Found ~/.zshrc. Backing up to ~/.zshrc.pre-oh-my-zsh"; + rm ~/.zshrc; + cp ~/.zshrc.pre-oh-my-zsh ~/.zshrc; + source ~/.zshrc; +else + echo "Switching back to bash" + chsh -s /bin/bash + source /etc/profile +fi + +echo "Thanks for trying out Oh My Zsh. It's been uninstalled." \ No newline at end of file