More fixes to the 'tools' shell-scripts.

This commit is contained in:
Chris2038 2011-09-16 21:30:26 +01:00
commit 08f8ce1ca8
4 changed files with 92 additions and 40 deletions

View file

@ -1,22 +1,41 @@
##################
# uninstall.sh #
##################
source ./common
proclaim 'Uninstalling Oh-My-Zsh'
if [[ -d ~/.oh-my-zsh ]]; then
echo "Removing '~/.oh-my-zsh'";
changes=`diff --unchanged-group-format='' --suppress-common-lines ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc`
changes=`echo "$changes" | grep -v "^export PATH=$PATH$"`
if [ ! -z "$changes" ]; then
info 'Appending changes to ~/.zshrc to ~/.zshrc.changes:'
text "$changes"
echo "$changes" >> ~/.zshrc.changes \
|| ( warn 'Cannot append to ~/.zshrc.changes!'; exit 1 )
fi
info 'Removing ~/.zshrc'
rm ~/.zshrc
info 'Removing ~/.oh-my-zsh'
rm -rf ~/.oh-my-zsh;
else
echo "Cannot find '~/.oh-my-zsh'";
exit 1
warn 'Cannot find ~/.oh-my-zsh'
exit 2
fi
if [ -f ~/.zshrc.pre-oh-my-zsh ] || [ -h ~/.zshrc.pre-oh-my-zsh ]
then
echo "Found '~/.zshrc.pre-oh-my-zsh', Restoring to ~/.zshrc";
info 'Found ~/.zshrc.pre-oh-my-zsh, Restoring to ~/.zshrc'
mv ~/.zshrc.pre-oh-my-zsh ~/.zshrc \
|| ( echo "cannot restore '~/.zshrc'!"; exit 2)
|| ( warn 'Cannot restore ~/.zshrc!'; exit 3 )
source ~/.zshrc;
else
echo "You might want to switch back to bash:";
echo "chsh -s /bin/bash";
echo "source /etc/profile";
note 'You might want to switch back to bash:'
shell_example \
'chsh -s /bin/bash' \
'source /etc/profile'
fi
echo "Thanks for trying out 'Oh My Zsh', It is no longer installed.";
proclaim 'Thanks for trying out \47Oh My Zsh\47, It is no longer installed'