installer: fix for Solus OS and systems with no /etc/shells
Co-authored-by: Fredrik Fornwall <fredrik@fornwall.net>
Diff
1diff --git a/tools/install.sh b/tools/install.sh
2index 4dc25b0e0f34ec540ae418c82668b52a16b0e70e..8ec973832ce3edd16035960df18e5d872f42f41f 100755
3--- a/tools/install.sh
4+++ b/tools/install.sh
5@@ -106,7 +106,18 @@ setup_shell() {
6 fi
7 8 echo "${BLUE}Time to change your default shell to zsh!${NORMAL}"
9- if ! chsh -s $(grep '^/.*/zsh$' /etc/shells | tail -1); then
10+
11+ # Test for the right location of the "shells" file
12+ if [ -f /etc/shells ]; then
13+ shells_file=/etc/shells
14+ elif [ -f /usr/share/defaults/etc/shells ]; then # Solus OS
15+ shells_file=/usr/share/defaults/etc/shells
16+ else
17+ error "could not find /etc/shells file. Change your default shell manually."
18+ return
19+ fi
20+
21+ if ! chsh -s $(grep '^/.*/zsh$' "$shells_file" | tail -1); then
22 error "chsh command unsuccessful. Change your default shell manually."
23 fi
24 }