11#! /bin/bash
22
33# Setup script for codeup student's laptops
4-
5- # TODO: setup mysql
6- # TODO: setup tomcat
7- # - both should be installable with brew.
8- # - brew has versions mysql 5.7, tomcat 8.5.5
9-
10- # Overview
11- # ========
4+ # =========================================
5+ #
6+ # This script will
7+ #
128# 1. check for xcode, if it does not exist go ahead and install it
139# 2. do the same for brew
1410# 3. if $HOME/.ssh/id_rsa does not exist, generate ssh keys and open github so
15- # it can be configured there
11+ # they can be configured there
12+ # 4. install java with brew cask
13+ # 5. check for maven and tomcat, install them with brew if not present
14+ # 6. check for mysql, install it and configure if not present
1615
1716wait-to-continue (){
1817 echo
@@ -36,6 +35,26 @@ install-xcode(){
3635 echo
3736}
3837
38+ install-java (){
39+ echo ' We are now going to use homebrew to install java. While your mac comes'
40+ echo ' with a version of java, it may not be the most recent version, and we want'
41+ echo ' everyone to be on the same version.'
42+ wait-to-continue
43+ brew cask install java
44+ }
45+
46+ install-tomcat (){
47+ echo ' We are now going to install tomcat, the java web server we will use for this course'
48+ wait-to-continue
49+ brew install tomcat
50+ }
51+
52+ install-maven (){
53+ echo ' We will now install maven, a build tool and dependency manager for java'
54+ wait-to-continue
55+ brew install maven
56+ }
57+
3958install-brew (){
4059 echo ' We are now going to install homebrew, a package manager for OSX.'
4160 wait-to-continue
@@ -76,6 +95,8 @@ setup-ssh-keys(){
7695install-mysql (){
7796 echo ' We are now going to install and configure MySQL, the database managment system we will'
7897 echo ' use for this course.'
98+ echo ' We will lock down your local MySQL install so that only you can only access it'
99+ echo ' from this computer'
79100 wait-to-continue
80101
81102 brew install mysql
@@ -95,10 +116,19 @@ DELETE FROM mysql.user WHERE User='';
95116DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%';
96117FLUSH PRIVILEGES;
97118EOF
98-
99119}
100120
101121echo ' We are going to check if xcode and brew are installed, and if you have ssh keys setup.'
122+ echo ' We will then setup our java development environment, including installing MySQL.'
123+ echo ' '
124+ echo ' All together we will be installing: '
125+ echo ' - xcode tools - brew'
126+ echo ' - java - maven'
127+ echo ' - tomcat - mysql'
128+ echo ' *Note*: if you have already setup any of the above on your computer, this script will _not_'
129+ echo ' attempt to reinstall them, please talk to an instructor to ensure everything'
130+ echo ' is configured properly'
131+ echo ' '
102132echo ' During this process you may be asked for your password several times. This is the password'
103133echo ' you use to log into your computer. When you type it in, you will not see any output in the'
104134echo ' terminal, this is normal.'
@@ -110,6 +140,13 @@ xcode-select --print-path >/dev/null 2>&1 || install-xcode
110140which brew > /dev/null 2>&1 || install-brew
111141[ -d $HOME /.ssh ] && [ -f $HOME /.ssh/id_rsa ] || setup-ssh-keys
112142
143+ # check if java was installed with brew cask if not install it
144+ brew cask list java > /dev/null 2>&1 || install-java
145+ # check for tomcat, maven, and mysql
146+ which mvn > /dev/null || install-maven
147+ which catalina > /dev/null || install-tomcat
148+ which mysql > /dev/null || install-mysql
149+
113150echo " Ok! We've gotten everything setup and you should be ready to go!"
114151echo " Good luck in class!"
115152echo
0 commit comments