-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.sh
executable file
·154 lines (127 loc) · 2.92 KB
/
bootstrap.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
#!/bin/bash
# Sets up our Vagrant VM
# ----------------------
# fix perl locale warning
cat /etc/environment | grep 'LC_ALL'
if [ "$?" -ne 0 ]
then
echo 'LC_ALL="en_US.UTF-8"' | sudo tee -a /etc/environment > /dev/null
fi
# install utility programs
echo
echo "* Installing utility programs ..."
echo
sleep 1
sudo apt-get update -y \
&& sudo apt-get install -y unzip python-software-properties dos2unix git
if [ "$?" -ne 0 ]
then
echo "failed."
exit 1;
fi
# install JDK 7
echo
echo "* Installing Oracle JDK 7 ..."
echo
sleep 1
sudo add-apt-repository ppa:webupd8team/java -y \
&& sudo apt-get update -y \
&& echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections \
&& echo debconf shared/accepted-oracle-license-v1-1 seen true | sudo debconf-set-selections \
&& sudo apt-get install -y oracle-java7-installer
if [ "$?" -ne 0 ]
then
echo "failed."
exit 1;
fi
# install MySQL
echo
echo "* Installing MySQL Server 5.5 ..."
echo
sleep 1
# set root password
sudo debconf-set-selections <<< 'mysql-server-5.5 mysql-server/root_password password waecm_2014' \
&& sudo debconf-set-selections <<< 'mysql-server-5.5 mysql-server/root_password_again password waecm_2014' \
&& sudo apt-get install -y mysql-server-5.5 \
&& sudo update-rc.d mysql defaults \
&& echo "CREATE DATABASE waecm_2014 CHARACTER SET utf8 COLLATE utf8_general_ci;" | mysql -uroot -pwaecm_2014
if [ "$?" -ne 0 ]
then
echo "failed."
exit 1;
fi
# install NodeJS + npm + gulp.js
echo
echo "* Installing NodeJS + npm + gulp.js ..."
echo
sleep 1
sudo apt-get install -y nodejs npm \
&& sudo ln -s /usr/bin/nodejs /usr/bin/node \
&& sudo npm install -g gulp
if [ "$?" -ne 0 ]
then
echo "failed."
exit 1;
fi
# install Ruby + SASS gem
echo
echo "* Installing Ruby + SASS ..."
echo
sleep 1
sudo apt-get install -y ruby-full \
&& sudo gem install sass rb-inotify
if [ "$?" -ne 0 ]
then
echo "failed."
exit 1;
fi
# download and extract Play framework
echo
echo "* Installing Play Framework ..."
echo
sleep 1
cd /vagrant
PLAY_VERSION=2.2.3
if [ -d "play-$PLAY_VERSION" ]
then
echo "skipped."
else
wget -nv "http://downloads.typesafe.com/play/$PLAY_VERSION/play-$PLAY_VERSION.zip" \
&& unzip "play-$PLAY_VERSION.zip" \
&& rm -f "play-$PLAY_VERSION.zip"
if [ $? -ne 0 ]
then
echo "failed."
rm -rf "play-$PLAY_VERSION"
rm -f "play-$PLAY_VERSION.zip"
exit 1;
fi
fi
# add play commands to PATH
echo "$PATH" | grep "play-$PLAY_VERSION"
if [ "$?" -ne 0 ]
then
PATH="$PATH:/vagrant/play-$PLAY_VERSION:/vagrant/play-$PLAY_VERSION/framework"
export PATH
# add new PATH to .bashrc
cd /home/vagrant
echo >> .bashrc
echo -e "export PATH=\$PATH:/vagrant/play-$PLAY_VERSION:/vagrant/play-$PLAY_VERSION/framework" >> .bashrc
. .bashrc
fi
# install npm dependencies for our project
echo
echo "* Installing NPM dependencies for project ..."
echo
sleep 1
cd /vagrant/csdr-g1
npm update
if [ "$?" -ne 0 ]
then
echo "failed."
exit 1;
fi
echo
echo "success."
echo
exit 0;