e8caf22beb8cde69f097382a75f6d1a247625030

Author
leycec <leycec@gmail.com>
Committer
leycec <leycec@gmail.com>
Date

Message

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.

Diff

 1diff --git a/tools/install.sh b/tools/install.sh
 2index 405f461e9288020b40d2fef468077b21fe319492..f5836fdf67723dd1fab4f8984f3849ea3299a76e 100755
 3--- a/tools/install.sh
 4+++ b/tools/install.sh
 5@@ -39,12 +39,17 @@ sed -i -e "/export PATH=/ c\\
 6 export PATH=\"$PATH\"
 7 " ~/.zshrc
 8 
 9-TEST_CURRENT_SHELL=$(expr "$SHELL" : '.*/\(.*\)')
10-if [ "$TEST_CURRENT_SHELL" != "zsh" ]; then
11+# If this user's login shell is not already "zsh", attempt to switch.
12+if [ "$(expr "$SHELL" : '.*/\(.*\)')" != "zsh" ]; then
13+  # If this platform provides a "chsh" command (not Cygwin), do it, man!
14+  if hash chsh >/dev/null 2>&1; then
15     echo "\033[0;34mTime to change your default shell to zsh!\033[0m"
16     chsh -s $(grep /zsh$ /etc/shells | tail -1)
17+  # Else, suggest the user do so manually.
18+  else
19+    echo "\033[0;34mPlease manually change your default shell to zsh!\033[0m"
20+  fi
21 fi
22-unset TEST_CURRENT_SHELL
23 
24 echo "\033[0;32m"'         __                                     __   '"\033[0m"
25 echo "\033[0;32m"'  ____  / /_     ____ ___  __  __   ____  _____/ /_  '"\033[0m"