03b8c199e591de73de3824fc6b366138964c1ba6

Author
Pablo Tamarit <pablo.tmrt@gmail.com>
Committer
Pablo Tamarit <pablo.tmrt@gmail.com>
Date

Message

Fix 'chsh' by checking '/etc/shells' instead of using 'which'

fix test for chsh in install
in case $SHELL is zsh but not the last one in /etc/shells
fixes #3026 fixes #3779 fixes #3780

Diff

 1diff --git a/tools/install.sh b/tools/install.sh
 2index bd4c5574988646ed5ebb55704e5046665b9c16bd..c83a6f23d0776abec9a189f90d0846d8d3036ab0 100755
 3--- a/tools/install.sh
 4+++ b/tools/install.sh
 5@@ -32,10 +32,12 @@ sed -i -e "/export PATH=/ c\\
 6 export PATH=\"$PATH\"
 7 " ~/.zshrc
 8 
 9-if [ "$SHELL" != "$(which zsh)" ]; then
10+TEST_CURRENT_SHELL=$(expr "$SHELL" : '.*/\(.*\)')
11+if [ "$TEST_CURRENT_SHELL" != "zsh" ]; then
12     echo "\033[0;34mTime to change your default shell to zsh!\033[0m"
13-    chsh -s `which zsh`
14+    chsh -s $(grep /zsh$ /etc/shells | tail -1)
15 fi
16+unset TEST_CURRENT_SHELL
17 
18 echo "\033[0;32m"'         __                                     __   '"\033[0m"
19 echo "\033[0;32m"'  ____  / /_     ____ ___  __  __   ____  _____/ /_  '"\033[0m"