From 17b86257dabd58f724e787d4111e3a853c524af2 Mon Sep 17 00:00:00 2001 From: Zach Whitten Date: Fri, 13 Oct 2017 14:33:22 -0400 Subject: [PATCH] Fix for #6299: restore previous default shell with uninstall --- tools/install.sh | 1 + tools/uninstall.sh | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/tools/install.sh b/tools/install.sh index 3f4de8681..b6491e25c 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -85,6 +85,7 @@ main() { if [ "$TEST_CURRENT_SHELL" != "zsh" ]; then # If this platform provides a "chsh" command (not Cygwin), do it, man! if hash chsh >/dev/null 2>&1; then + echo $SHELL > ~/.default-shell.pre-oh-my-zsh printf "${BLUE}Time to change your default shell to zsh!${NORMAL}\n" chsh -s $(grep /zsh$ /etc/shells | tail -1) # Else, suggest the user do so manually. diff --git a/tools/uninstall.sh b/tools/uninstall.sh index bf2244be8..d1e60c14d 100644 --- a/tools/uninstall.sh +++ b/tools/uninstall.sh @@ -21,6 +21,12 @@ if [ -f ~/.zshrc.pre-oh-my-zsh ] || [ -h ~/.zshrc.pre-oh-my-zsh ]; then mv ~/.zshrc.pre-oh-my-zsh ~/.zshrc; + if [ -f ~/.default-shell.pre-oh-my-zsh ] && hash chsh >/dev/null 2>&1; then + previous=$(cat ~/.default-shell.pre-oh-my-zsh) + echo "Switching your shell back to $previous" + chsh -s $previous + fi + echo "Your original zsh config was restored. Please restart your session." else if hash chsh >/dev/null 2>&1; then