1cf42a506ff55d12c3246239332469d193bbf4b1

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

Message

installer: add option to not run zsh at the end

Co-authored-by: Liquidsoul <liquidsoul@liquidsoul.fr>
Co-authored-by: Alexander Polynomdivision <digitalmail555@googlemail.com>
Co-authored-by: loket <loket@cruftlab.io>
Co-authored-by: Connor Demille <subtlepseudonym@gmail.com>

Diff

 1diff --git a/tools/install.sh b/tools/install.sh
 2index 2d29365313c785826ef08d91aebf25efccc56fd2..9eb83cfbd1f445164277a95bdc1e58f41e971c48 100755
 3--- a/tools/install.sh
 4+++ b/tools/install.sh
 5@@ -15,7 +15,8 @@
 6 #   REMOTE  - full remote URL of the git repo to install (default: GitHub via HTTPS)
 7 #   BRANCH  - branch to check out immediately after install (default: master)
 8 # Other options:
 9-#   CHSH    - set to no tells the installer not to change the default shell (default: yes)
10+#   CHSH    - 'no' means the installer will not change the default shell (default: yes)
11+#   RUNZSH  - 'no' means the installer will not run zsh after the install (default: yes)
12 #
13 set -e
14 
15@@ -27,6 +28,7 @@ BRANCH=${BRANCH:-master}
16 
17 # Other options
18 CHSH=${CHSH:-yes}
19+RUNZSH=${RUNZSH:-yes}
20 
21 
22 command_exists() {
23@@ -126,7 +128,7 @@ export ZSH=\"$ZSH\"
24 
25 setup_shell() {
26 	# Skip setup if the user wants or stdin is closed (not running interactively).
27-	if [ $CHSH = no ] || ! [ -t 0 ]; then
28+	if [ $CHSH = no ]; then
29 		return
30 	fi
31 
32@@ -173,9 +175,15 @@ setup_shell() {
33 }
34 
35 main() {
36+	if [ ! -t 0 ]; then
37+		RUNZSH=no
38+		CHSH=no
39+	fi
40+
41 	# Parse arguments
42 	while [ $# -gt 0 ]; do
43 		case $1 in
44+			--silent|--batch) RUNZSH=no; CHSH=no ;;
45 			--skip-chsh) CHSH=no ;;
46 		esac
47 		shift
48@@ -219,7 +227,7 @@ main() {
49 	EOF
50 	printf "$RESET"
51 
52-	if [ ! -t 0 ]; then
53+	if [ $RUNZSH = no ]; then
54 		echo "${YELLOW}Run zsh to try it out.${RESET}"
55 		exit
56 	fi