-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·260 lines (198 loc) · 5.1 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
#!/usr/bin/env bash
set -e # stops the script when an error is triggered
#===================================================================================
# load the needed scripts
#===================================================================================
current_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
helpers_dir="$( cd $current_dir && cd helpers && pwd )"
source $helpers_dir/colors.sh
source $helpers_dir/greetings.sh
source $helpers_dir/animations.sh
skipQuestions=false
#===================================================================================
# changelog
#===================================================================================
title="install.sh"
description="This script will install all system configurations from scratch (including all the needed apps)."
author="ZeRodrigues"
date="5/11/2018"
version="0.1.0"
function init() {
clear
hello
changelog "$title" "$description" "$author" "$date" "$version"
if ! $skipQuestions; then
disclaimer
yellow_color
echo "I just need your password once... "
sudo -v #ask password beforehand
fi
}
function disclaimer() {
yellow_color
echo "Disclaimer: this script will not install anything without your consent!"
echo
green_color
read -p "Do you want to proceed with installation? (y/N) " -n 1 answer
echo
if [ ${answer} != "y" ]; then
red_color
echo "Sorry to see you leaving so soon... take care!"
exit 1
fi
}
function read_variables() {
if [[ -n ${1+x} ]]; then
skipQuestions=$1
fi
}
function install_xcode() {
reset_color
echo "Detecting installed Command Line Tools..."
if ! [ $(xcode-select -p) ]; then
yellow_color
echo "You don't have xcode installed"
echo "They are required to proceed with installation"
if ! $skipQuestions; then
green_color
read -p "Do you agree to install Command Line Tools? (y/N) " -n 1 answer
echo
if ! $skipQuestions && [ ${answer} != "y" ]; then
yellow_color
echo "Skipping the installation..."
exit 1
fi
fi
blue_color
echo "Installing xcode..."
echo "Please, wait until Command Line Tools will be installed, before continue"
xcode-select --install
else
yellow_color
echo "Xcode is already installed..."
fi
reset_color
separator
sleep 1
}
function install_homebrew() {
reset_color
echo "Detecting if Homebrew is installed..."
if ! [ $(which brew) ]; then
yellow_color
echo "Homebrew is not installed"
reset_color
echo "Installing Homebrew..."
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
green_color
echo "Homebrew installed!"
reset_color
echo "Updating Homebrew..."
brew update
green_color
echo "Homebrew updated!"
reset_color
separator
sleep 1
}
function install_php()
{
yellow_color
echo "Installing all PHP related tools..."
brew install php
echo "Installing imagick"
yes | pecl install imagick
echo "Installing xdebug"
pecl install xdebug
green_color
echo "PHP installed!"
reset_color
separator
sleep 1
}
function install_composer()
{
yellow_color
echo "Installing composer..."
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
green_color
echo "Composer installed!"
reset_color
separator
sleep 1
}
function install_bat()
{
blue_color
echo "Trying to detect if bat is installed..."
if ! [ $(which bat) ]; then
yellow_color
echo "Bat is not installed"
reset_color
echo "Installing bat..."
brew install bat
fi
green_color
echo "Bat installed!"
}
function cleanup(){
reset_color
echo "Cleaning old brew installations..."
brew cleanup
echo "Clean up done!"
}
function terminal(){
reset_color
echo
echo "Configuring your terminal..."
#install_xcode
install_homebrew
install_php
install_composer
install_bat
}
function apps()
{
yellow_color
echo "Installing all the required apps..."
brew tap homebrew/bundle
brew bundle
green_color
echo "Apps installed!"
separator
}
function macos(){
reset_color
echo
echo "Configuring your macos..."
proceed_question ""
}
function symlink_files()
{
reset_color
echo
echo "Making the remaining configurations..."
}
function goodbye() {
green_color
echo
echo
echo "This mac was successfully prepared for your daily use!"
echo
blue_color
echo "A couple of tips before you go:"
echo " - run 'work' to open all the needed apps for your work day."
echo " - run 'gohome' to close all work related apps."
echo
green_color
echo "It's all for now. Have a great time!"
reset_color
exit 0
}
read_variables $1
init
terminal
#symlink_files
goodbye