Fix for #6299: restore previous default shell with uninstall

This commit is contained in:
Zach Whitten 2017-10-13 14:33:22 -04:00
commit 17b86257da
2 changed files with 7 additions and 0 deletions

View file

@ -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.

View file

@ -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