1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-12-25 05:41:58 +00:00

Merge pull request #3646 from apjanke/installer-cygwin-support-3

Add Cygwin support to installer.
This commit is contained in:
Robby Russell 2015-09-26 09:35:39 -07:00
commit 935948cf3b
2 changed files with 27 additions and 8 deletions

View file

@ -46,10 +46,23 @@ fi
umask g-w,o-w umask g-w,o-w
printf "${BLUE}Cloning Oh My Zsh...${NORMAL}\n" printf "${BLUE}Cloning Oh My Zsh...${NORMAL}\n"
hash git >/dev/null 2>&1 && env git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git $ZSH || { hash git >/dev/null 2>&1 || {
printf "git not installed\n" echo "Error: git is not installed"
exit exit 1
} }
env git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git $ZSH || {
printf "Error: git clone of oh-my-zsh repo failed\n"
exit 1
}
# The Windows (MSYS) Git is not compatible with normal use on cygwin
if [ "$OSTYPE" = cygwin ]; then
if git --version | grep msysgit > /dev/null; then
echo "Error: Windows/MSYS Git is not supported on Cygwin"
echo "Error: Make sure the Cygwin git package is installed and is first on the path"
exit 1
fi
fi
printf "${BLUE}Looking for an existing zsh config...${NORMAL}\n" printf "${BLUE}Looking for an existing zsh config...${NORMAL}\n"
if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then
@ -71,13 +84,15 @@ export PATH=\"$PATH\"
mv -f ~/.zshrc-omztemp ~/.zshrc mv -f ~/.zshrc-omztemp ~/.zshrc
# If this user's login shell is not already "zsh", attempt to switch. # If this user's login shell is not already "zsh", attempt to switch.
if [ "$(expr "$SHELL" : '.*/\(.*\)')" != "zsh" ]; then TEST_CURRENT_SHELL=$(expr "$SHELL" : '.*/\(.*\)')
if [ "$TEST_CURRENT_SHELL" != "zsh" ]; then
# If this platform provides a "chsh" command (not Cygwin), do it, man! # If this platform provides a "chsh" command (not Cygwin), do it, man!
if hash chsh >/dev/null 2>&1; then if hash chsh >/dev/null 2>&1; then
printf "${BLUE}Time to change your default shell to zsh!${NORMAL}\n" printf "${BLUE}Time to change your default shell to zsh!${NORMAL}\n"
chsh -s $(grep /zsh$ /etc/shells | tail -1) chsh -s $(grep /zsh$ /etc/shells | tail -1)
# Else, suggest the user do so manually. # Else, suggest the user do so manually.
else else
printf "I can't change your shell automatically because this system does not have chsh.\n"
printf "${BLUE}Please manually change your default shell to zsh!${NORMAL}\n" printf "${BLUE}Please manually change your default shell to zsh!${NORMAL}\n"
fi fi
fi fi

View file

@ -1,5 +1,5 @@
echo "Removing ~/.oh-my-zsh" echo "Removing ~/.oh-my-zsh"
if [[ -d ~/.oh-my-zsh ]] if [ -d ~/.oh-my-zsh ]
then then
rm -rf ~/.oh-my-zsh rm -rf ~/.oh-my-zsh
fi fi
@ -20,9 +20,13 @@ then
source ~/.zshrc; source ~/.zshrc;
else else
if hash chsh >/dev/null 2>&1
then
echo "Switching back to bash" echo "Switching back to bash"
chsh -s /bin/bash chsh -s /bin/bash
source /etc/profile else
echo "You can edit /etc/passwd to switch your default shell back to bash"
fi
fi 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."