66d6d08841ebde3610eaee961f63f8420e914d3b

Author
Marc Cornellà <marc.cornella@live.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

installer: improve message formatting and color

Diff

 1diff --git a/tools/install.sh b/tools/install.sh
 2index 8763b351317e49475ba7317e513314211e922e89..3f0e468fe8ebcfcd7fe0c83c4426e87e58c405ee 100755
 3--- a/tools/install.sh
 4+++ b/tools/install.sh
 5@@ -101,6 +101,8 @@ setup_ohmyzsh() {
 6 		error "git clone of oh-my-zsh repo failed"
 7 		exit 1
 8 	}
 9+
10+	echo
11 }
12 
13 setup_zshrc() {
14@@ -128,13 +130,15 @@ setup_zshrc() {
15 		mv ~/.zshrc "$OLD_ZSHRC"
16 	fi
17 
18-	echo "${BLUE}Using the Oh My Zsh template file and adding it to ~/.zshrc.${RESET}"
19+	echo "${GREEN}Using the Oh My Zsh template file and adding it to ~/.zshrc.${RESET}"
20 
21 	cp "$ZSH/templates/zshrc.zsh-template" ~/.zshrc
22 	sed "/^export ZSH=/ c\\
23 export ZSH=\"$ZSH\"
24 " ~/.zshrc > ~/.zshrc-omztemp
25 	mv -f ~/.zshrc-omztemp ~/.zshrc
26+
27+	echo
28 }
29 
30 setup_shell() {
31@@ -157,7 +161,7 @@ setup_shell() {
32 		return
33 	fi
34 
35-	echo "${BLUE}Time to change your default shell to zsh!${RESET}"
36+	echo "${BLUE}Time to change your default shell to zsh:${RESET}"
37 
38 	# Test for the right location of the "shells" file
39 	if [ -f /etc/shells ]; then
40@@ -174,7 +178,8 @@ setup_shell() {
41 	# 2. If that fails, get a zsh path from the shells file, then check it actually exists
42 	if ! zsh=$(which zsh) || ! grep -qx "$zsh" "$shells_file"; then
43 		if ! zsh=$(grep '^/.*/zsh$' "$shells_file" | tail -1) || [ ! -f "$zsh" ]; then
44-			error "no available zsh binary found. Change your default shell manually."
45+			error "no zsh binary found or not present in '$shells_file'"
46+			error "change your default shell manually."
47 			return
48 		fi
49 	fi
50@@ -182,7 +187,12 @@ setup_shell() {
51 	# Actually change the default shell to zsh
52 	if ! chsh -s "$zsh"; then
53 		error "chsh command unsuccessful. Change your default shell manually."
54+	else
55+		export SHELL="$zsh"
56+		echo "${GREEN}Shell successfully changed to '$zsh'.${RESET}"
57 	fi
58+
59+	echo
60 }
61 
62 main() {