-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
409 lines (381 loc) · 12.2 KB
/
setup.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
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
#!/bin/bash
#software for DTS Developers
developers(){
# Collection of packages to install
PACKAGES=(
git
node@14
postgresql@12
libpq
python3
azure-cli
yq
)
# Same packages, but a Seperate list for uninstall packages, as the order may need to be different
PACKAGES_UNINSTALL=(
azure-cli
git
node@14
postgresql@12
libpq
python3
yq
)
echo "$MODE-ing packages..."
doBrewPackageInstallOrUninstall;
echo "Cleaning up..."
brew cleanup
#now install casks
CASKS=(
docker
adoptopenjdk
intellij-idea
pycharm
slack
google-chrome
pgadmin4
parallels
)
# Same Casks, but a Seperate list for uninstall casks, as the order may need to be different
CASKS_UNINSTALL=(
docker
adoptopenjdk
intellij-idea
pycharm
slack
google-chrome
pgadmin4
)
echo "$MODE-ing cask apps..."
doBrewCaskInstallOrUninstall;
echo "Cleaning up..."
brew cleanup
#if the mode is to uninstall, ensure that the uninstall of parallels is done, as a special case.
if [ "$MODE" = "uninstall" ]
then
parallels_uninstall
else
echo "Finished the install"
fi
}
#software for A&P Data Engineers
dataengineers(){
# Collection of packages to install
PACKAGES=(
git
npm
postgresql
python3
azure-cli
)
# Same packages, but a Seperate list for uninstall packages, as the order may need to be different
PACKAGES_UNINSTALL=(
azure-cli
git
npm
postgresql
python3
)
echo "$MODE-ing packages..."
doBrewPackageInstallOrUninstall;
echo "Cleaning up..."
brew cleanup
#now install casks
CASKS=(
docker
pycharm
azure-data-studio
microsoft-azure-storage-explorer
R
rstudio
# visual-studio
visual-studio-code
# virtualbox
slack
google-chrome
pgadmin4
parallels
)
# Same Casks, but a Seperate list for uninstall casks, as the order may need to be different
CASKS_UNINSTALL=(
docker
pycharm
azure-data-studio
microsoft-azure-storage-explorer
R
rstudio
# visual-studio
visual-studio-code
# virtualbox
slack
google-chrome
pgadmin4
)
echo "$MODE-ing cask apps..."
doBrewCaskInstallOrUninstall;
echo "Cleaning up..."
brew cleanup
#if the mode is to uninstall, ensure that the uninstall of parallels is done, as a special case.
if [ "$MODE" = "uninstall" ]
then
parallels_uninstall
else
echo "Finished the install"
fi
}
#all software
allsoftware(){
# Collection of packages to install
PACKAGES=(
git
npm
postgresql
libpq
python3
azure-cli
yq
)
# Same packages, but a Seperate list for uninstall packages, as the order may need to be different
PACKAGES_UNINSTALL=(
azure-cli
git
npm
postgresql
libpq
python3
yq
)
echo "$MODE-ing packages..."
doBrewPackageInstallOrUninstall;
echo "Cleaning up..."
brew cleanup
#now install casks
CASKS=(
adoptopenjdk
intellij-idea
docker
pycharm
azure-data-studio
microsoft-azure-storage-explorer
R
rstudio
visual-studio
visual-studio-code
# virtualbox
slack
google-chrome
pgadmin4
parallels
)
# Same Casks, but a Seperate list for uninstall casks, as the order may need to be different
CASKS_UNINSTALL=(
adoptopenjdk #password may be necessary
intellij-idea
docker #password alwyas seems to be required
pycharm
azure-data-studio
microsoft-azure-storage-explorer
R #password may be necessary
rstudio
visual-studio
visual-studio-code
# virtualbox
slack
google-chrome
pgadmin4
)
echo "$MODE-ing cask apps..."
doBrewCaskInstallOrUninstall;
echo "Cleaning up..."
brew cleanup
#if the mode is to uninstall, ensure that the uninstall of parallels is done, as a special case.
if [ "$MODE" = "uninstall" ]
then
parallels_uninstall
else
echo "Finished the install"
fi
}
#parallels uninstall special case
parallels_uninstall(){
echo "Uninstalling parallels now...."
brew uninstall --cask --force parallels
echo "Cleaning up..."
brew cleanup
cat << "EOF2"
The uninstall has now finished.....
**** Steps to complete Post uninstall of parallels ****
Please read the below...
The uninstall of parallels should have completed. However, due to an anomoly with the way that parallels installs
, the uninstall may or may not have reported an error. Please follow the instructions below carefully..
you may have seen something like this at the end of the parallels uninstall...
--------------------------------------------------------------------------
Cleaning up...
Error: Permission denied @ apply2files - /usr/local/share/man/man8/prl_convert.8
Steps to carry out to resolve any errors...
------------------------------------------
1. Try and check the health of brew. Try to install something that you havent already got, and see if brew complains. eg. try and install jq.
>brew install jq (if you already have jq installed, please do a brew uninstall jq followed by the install)
2. If you dont see any errors, then you can exit now, as parallels would have uninstalled without causing any problems.
3. However, if you did see an error, then brew tells you how to rectify this.
4. Follow the instructions given by brew, if it is only changing the owner of the /usr/local/share/man/man8 directory, as this is fairly harmless thing to do.
5. If it is merely changing the owner, please indeed follow the suggested solution by brew.
6. If it is more complex, then please seek help from the authors of this script.
EOF2
}
doBrewPackageInstallOrUninstall(){
#Note: This function uses the following global variables to have been set before its call
# MODE : install or uninstall
# PACKAGES : The list of packages that are going to be installed (if this is an install)
# PACKAGES_UNINSTALL : The list of packages that are going to be installed (if this is an install)
case "$MODE" in
'install')
brew install ${PACKAGES[@]}
;;
'uninstall')
for i in "${PACKAGES_UNINSTALL[@]}"; do
echo "uninstalling package $i...."
brew uninstall $i
done
;;
*)
echo "unexpected error. Exiting...."
return 1
esac
}
doBrewCaskInstallOrUninstall(){
#Note: This function uses the following global variables to have been set before its call
# MODE : install or uninstall
# CASKS : The list of casks that are going to be installed (if this is an install)
# CASKS_UNINSTALL : The list of casks that are going to be installed (if this is an install)
case "$MODE" in
'install')
brew install --cask --force ${CASKS[@]}
;;
'uninstall')
for i in "${CASKS_UNINSTALL[@]}"; do
echo "Uninstalling cask $i....."
brew uninstall --cask --force $i
done
;;
*)
echo "unexpected error. Exiting...."
return 1
esac
}
# Install homebrew if not already installed
install_homebrew(){
if test ! $(which brew); then
echo "Installing homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
fi
# Update homebrew
brew update
}
clear
# Bootstrap script for setting up a new OSX machine
# for Digital Delivery devs and QAs.
# Version 0.1 - Thomas Geraghty
# Version 0.2 - Thomas Geraghty
# Version 0.3 - Sandy Gudgeon
# Version 0.4 - Thomas Geraghty
# Version 0.5 - Rajiv Kapoor (added uninstall functionality)
cat << "EOF"
_ _ ___ ________ _____ _____ _____________
| | | || \/ / __ \_ _/ ___| | _.+._ |
| |_| || . . | / \/ | | \ `--. | (^\/^\/^) |
| _ || |\/| | | | | `--. \ | \@*@*@/ |
| | | || | | | \__/\ | | /\__/ / | {_____} |
\_| |_/\_| |_/\____/ \_/ \____/ |___________|
____ _____ _____
| \|_ _| __| Welcome to Digital Delivery
| | | | | |__ | Inspiring change and lookin' cool
|____/ |_| |_____| whilst we do it!
EOF
echo
echo "DTS Macbook Development Tools Installer V0.3"
echo ""
echo "Any problems email :"
echo "Thomas Geraghty - [email protected] for DTS Developer/QA queries"
echo "Alexander Gudgeon - [email protected] for A&P Data Engineering queries"
echo ""
ECHO "Pease enter your choice: "
options=("Install DTS Developer Tools" "Install A&P Data Engineer Tools" "Install All Tools" "*UNINSTALL DTS Developer Tools" "*UNINSTALL A&P Data Engineer Tools" "*UNINSTALL All Tools" "Quit")
select opt in "${options[@]}"
do
case $opt in
"Install DTS Developer Tools")
echo "you chose to install tools for $opt - $REPLY"
MODE=install
install_homebrew
developers
break
;;
"Install A&P Data Engineer Tools")
echo "you chose to install tools for $opt - $REPLY"
MODE=install
install_homebrew
dataengineers
break
;;
"Install All Tools")
echo "you chose choice to install $opt - $REPLY"
MODE=install
install_homebrew
allsoftware
break
;;
"*UNINSTALL DTS Developer Tools")
echo "you chose to Uninstall tools for $opt - $REPLY"
MODE=uninstall
#check that folks are sure whether they wish to uninstall....
echo -n "Answer \"yes\" if you are sure you wish to uninstall..."
read ANSWER
if [ "$ANSWER" = "yes" ]
then
#even though we are uninstalling we still need to install brew
install_homebrew
developers
else
echo "Bailing out..."
fi
break
;;
"*UNINSTALL A&P Data Engineer Tools")
echo "you chose to Uninstall tools for $opt - $REPLY"
MODE=uninstall
#check that folks are sure whether they wish to uninstall....
echo -n "Answer \"yes\" if you are sure you wish to uninstall..."
read ANSWER
if [ "$ANSWER" = "yes" ]
then
#even though we are uninstalling we still need to install brew
install_homebrew
dataengineers
else
echo "Bailing out..."
fi
break
;;
"*UNINSTALL All Tools")
echo "you chose choice to Uninstall $opt - $REPLY"
MODE=uninstall
#check that folks are sure whether they wish to uninstall....
echo -n "Answer \"yes\" if you are sure you wish to uninstall..."
read ANSWER
if [ "$ANSWER" = "yes" ]
then
#even though we are uninstalling we still need to install brew
install_homebrew
allsoftware
else
echo "Bailing out..."
fi
break
;;
"Quit")
break
;;
*) echo "invalid option $REPLY";;
esac
done