Update install.sh to not rely on /etc/shells
This commit is contained in:
parent
cffd3b85f3
commit
c1e4df89f4
@ -24,9 +24,12 @@ main() {
|
|||||||
# which may fail on systems lacking tput or terminfo
|
# which may fail on systems lacking tput or terminfo
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
CHECK_ZSH_INSTALLED=$(grep /zsh$ /etc/shells | wc -l)
|
ZSH_LOCATION=$(grep /zsh$ /etc/shells | tail -1)
|
||||||
if [ ! $CHECK_ZSH_INSTALLED -ge 1 ] && ! which zsh 2> /dev/null; then
|
if [ -z "$ZSH_LOCATION" ]; then
|
||||||
printf "${YELLOW}Zsh is not installed!${NORMAL} Please install zsh first!\n"
|
ZSH_LOCATION=$(which zsh 2>/dev/null)
|
||||||
|
fi
|
||||||
|
if [ -z "$ZSH_LOCATION" ]; then
|
||||||
|
printf "${YELLOW}Can't find zsh!${NORMAL} Please ensure it is installed!\n"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
unset CHECK_ZSH_INSTALLED
|
unset CHECK_ZSH_INSTALLED
|
||||||
@ -86,7 +89,7 @@ main() {
|
|||||||
# 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 "$ZSH_LOCATION"
|
||||||
# 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 "I can't change your shell automatically because this system does not have chsh.\n"
|
||||||
|
Loading…
Reference in New Issue
Block a user