Cygwin-specific "chsh" installation issue fixed.

Installation previously assumed the existence of a "chsh" command in the current
${PATH}. Since Cygwin does *NOT* provide this command, installation now tests
for the existence of this command before attempting to run it.
This commit is contained in:
leycec 2015-07-11 00:54:36 -04:00
parent da395c5837
commit e8caf22beb

View File

@ -39,12 +39,17 @@ sed -i -e "/export PATH=/ c\\
export PATH=\"$PATH\" export PATH=\"$PATH\"
" ~/.zshrc " ~/.zshrc
TEST_CURRENT_SHELL=$(expr "$SHELL" : '.*/\(.*\)') # If this user's login shell is not already "zsh", attempt to switch.
if [ "$TEST_CURRENT_SHELL" != "zsh" ]; then if [ "$(expr "$SHELL" : '.*/\(.*\)')" != "zsh" ]; then
# If this platform provides a "chsh" command (not Cygwin), do it, man!
if hash chsh >/dev/null 2>&1; then
echo "\033[0;34mTime to change your default shell to zsh!\033[0m" echo "\033[0;34mTime to change your default shell to zsh!\033[0m"
chsh -s $(grep /zsh$ /etc/shells | tail -1) chsh -s $(grep /zsh$ /etc/shells | tail -1)
# Else, suggest the user do so manually.
else
echo "\033[0;34mPlease manually change your default shell to zsh!\033[0m"
fi
fi fi
unset TEST_CURRENT_SHELL
echo "\033[0;32m"' __ __ '"\033[0m" echo "\033[0;32m"' __ __ '"\033[0m"
echo "\033[0;32m"' ____ / /_ ____ ___ __ __ ____ _____/ /_ '"\033[0m" echo "\033[0;32m"' ____ / /_ ____ ___ __ __ ____ _____/ /_ '"\033[0m"