Diff
1diff --git a/tools/install.sh b/tools/install.sh
2index 30d66d4b53b37a753dd6ea3f653c88e3553fb695..5633320a85e23fa1004133f9ecdf08ddcea4a82b 100755
3--- a/tools/install.sh
4+++ b/tools/install.sh
5@@ -46,11 +46,24 @@ fi
6 umask g-w,o-w
7
8 printf "${BLUE}Cloning Oh My Zsh...${NORMAL}\n"
9-hash git >/dev/null 2>&1 && env git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git $ZSH || {
10- printf "git not installed\n"
11- exit
12+hash git >/dev/null 2>&1 || {
13+ echo "Error: git is not installed"
14+ exit 1
15+}
16+env git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git $ZSH || {
17+ printf "Error: git clone of oh-my-zsh repo failed\n"
18+ exit 1
19 }
20
21+# The Windows (MSYS) Git is not compatible with normal use on cygwin
22+if [ "$OSTYPE" = cygwin ]; then
23+ if git --version | grep msysgit > /dev/null; then
24+ echo "Error: Windows/MSYS Git is not supported on Cygwin"
25+ echo "Error: Make sure the Cygwin git package is installed and is first on the path"
26+ exit 1
27+ fi
28+fi
29+
30 printf "${BLUE}Looking for an existing zsh config...${NORMAL}\n"
31 if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then
32 printf "${YELLOW}Found ~/.zshrc.${NORMAL} ${GREEN}Backing up to ~/.zshrc.pre-oh-my-zsh${NORMAL}\n";
33@@ -71,13 +84,15 @@ export PATH=\"$PATH\"
34 mv -f ~/.zshrc-omztemp ~/.zshrc
35
36 # If this user's login shell is not already "zsh", attempt to switch.
37-if [ "$(expr "$SHELL" : '.*/\(.*\)')" != "zsh" ]; then
38+TEST_CURRENT_SHELL=$(expr "$SHELL" : '.*/\(.*\)')
39+if [ "$TEST_CURRENT_SHELL" != "zsh" ]; then
40 # If this platform provides a "chsh" command (not Cygwin), do it, man!
41 if hash chsh >/dev/null 2>&1; then
42 printf "${BLUE}Time to change your default shell to zsh!${NORMAL}\n"
43 chsh -s $(grep /zsh$ /etc/shells | tail -1)
44 # Else, suggest the user do so manually.
45 else
46+ printf "I can't change your shell automatically because this system does not have chsh.\n"
47 printf "${BLUE}Please manually change your default shell to zsh!${NORMAL}\n"
48 fi
49 fi
50diff --git a/tools/uninstall.sh b/tools/uninstall.sh
51index 41d6015769d4c7a5ef06d087c58f80bf6a07a106..23bfac0eb5f07907fa844c2aafb029872fdbef2d 100644
52--- a/tools/uninstall.sh
53+++ b/tools/uninstall.sh
54@@ -1,5 +1,5 @@
55 echo "Removing ~/.oh-my-zsh"
56-if [[ -d ~/.oh-my-zsh ]]
57+if [ -d ~/.oh-my-zsh ]
58 then
59 rm -rf ~/.oh-my-zsh
60 fi
61@@ -20,9 +20,13 @@ then
62
63 source ~/.zshrc;
64 else
65- echo "Switching back to bash"
66- chsh -s /bin/bash
67- source /etc/profile
68+ if hash chsh >/dev/null 2>&1
69+ then
70+ echo "Switching back to bash"
71+ chsh -s /bin/bash
72+ else
73+ echo "You can edit /etc/passwd to switch your default shell back to bash"
74+ fi
75 fi
76
77 echo "Thanks for trying out Oh My Zsh. It's been uninstalled."