Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Being more careful with .zshrc during install/uninstall. #1271

Closed
wants to merge 1 commit into from

2 participants

probablynot Robby Russell
probablynot

install.sh:
In the case where copy fails, remove will probably succeed.
For example, if the file system were full. So we're trying
to be more careful with .zshrc here.

uninstall.sh:
The messages are not accurate to what the script is doing
with .zshrc -- It says, "Backing up to .zshrc.pre-oh-my-zsh"
but the next line removes it. So we should rename .zshrc
instead of removing it before we restore the original.

probablynot probablynot Being more accurate and careful with .zshrc during install/uninstall
install.sh:
  In the case where copy fails, remove will probably succeed.
For example, if the file system were full.  So we're trying
to be more careful with .zshrc here.

uninstall.sh:
  The messages are not accurate to what the script is doing
with .zshrc -- It says, "Backing up to .zshrc.pre-oh-my-zsh"
but the next line removes it.  So we should rename .zshrc
instead of removing it before we restore the original.
b0aa4b6
Robby Russell
Owner

Merged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 4, 2012
  1. probablynot

    Being more accurate and careful with .zshrc during install/uninstall

    probablynot authored
    install.sh:
      In the case where copy fails, remove will probably succeed.
    For example, if the file system were full.  So we're trying
    to be more careful with .zshrc here.
    
    uninstall.sh:
      The messages are not accurate to what the script is doing
    with .zshrc -- It says, "Backing up to .zshrc.pre-oh-my-zsh"
    but the next line removes it.  So we should rename .zshrc
    instead of removing it before we restore the original.
This page is out of date. Refresh to see the latest.
Showing with 15 additions and 8 deletions.
  1. +2 −3 tools/install.sh
  2. +13 −5 tools/uninstall.sh
5 tools/install.sh
View
@@ -13,9 +13,8 @@ hash git >/dev/null && /usr/bin/env git clone https://github.com/robbyrussell/oh
echo "\033[0;34mLooking for an existing zsh config...\033[0m"
if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]
then
- echo "\033[0;33mFound ~/.zshrc.\033[0m \033[0;32]Backing up to ~/.zshrc.pre-oh-my-zsh\033[0m";
- cp ~/.zshrc ~/.zshrc.pre-oh-my-zsh;
- rm ~/.zshrc;
+ echo "\033[0;33mFound ~/.zshrc\033[0m \033[0;32] -- Renaming to ~/.zshrc.pre-oh-my-zsh\033[0m";
+ mv ~/.zshrc ~/.zshrc.pre-oh-my-zsh;
fi
echo "\033[0;34mUsing the Oh My Zsh template file and adding it to ~/.zshrc\033[0m"
18 tools/uninstall.sh
View
@@ -4,12 +4,20 @@ then
rm -rf ~/.oh-my-zsh
fi
-echo "Looking for an existing zsh config..."
+echo "Looking for original 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;
+ echo "Found ~/.zshrc.pre-oh-my-zsh -- Restoring to ~/.zshrc";
+
+ if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]
+ then
+ ZSHRC_SAVE=".zshrc.omz-uninstalled-`date +%Y%m%d%H%M%S`";
+ echo "Found ~/.zshrc -- Renaming to ~/${ZSHRC_SAVE}";
+ mv ~/.zshrc ~/${ZSHRC_SAVE};
+ fi
+
+ mv ~/.zshrc.pre-oh-my-zsh ~/.zshrc;
+
source ~/.zshrc;
else
echo "Switching back to bash"
@@ -17,4 +25,4 @@ else
source /etc/profile
fi
-echo "Thanks for trying out Oh My Zsh. It's been uninstalled."
+echo "Thanks for trying out Oh My Zsh. It's been uninstalled."
Something went wrong with that request. Please try again.