forked from intracer/wlxjury
-
Notifications
You must be signed in to change notification settings - Fork 0
/
provision_centos.sh
50 lines (39 loc) · 1.01 KB
/
provision_centos.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
#!/bin/bash
DB_NAME=wlxjury_db
DB_USER_NAME=wlx_jury_user
DB_USER_PASSW=wlx_jury
rpmPackage=false
rpm --quiet -q java-1.8.0-openjdk
if [ $? != 0 ] ; then
yum -y install java-1.8.0-openjdk*
fi
rpm --quiet -q sbt
if [ $? != 0 ] ; then
curl https://bintray.com/sbt/rpm/rpm > bintray-sbt-rpm.repo
mv bintray-sbt-rpm.repo /etc/yum.repos.d/
yum -y install sbt
fi
rpm --quiet -q mariadb-server
if [ $? != 0 ] ; then
yum -y install mariadb-server
systemctl start mariadb
systemctl enable mariadb
fi
if ! mysql -u root -e "use $DB_NAME"; then
mysql -u root -e "create database $DB_NAME; GRANT ALL PRIVILEGES ON $DB_NAME.* TO $DB_USER_NAME@localhost IDENTIFIED BY '$DB_USER_PASSW'"
fi
cd /vagrant
if [ "$rpmPackage" = true ] ; then
rpm --quiet -q rpm-build
if [ $? != 0 ] ; then
yum -y install rpm-build
fi
sbt -v clean packageRpmSystemd
rpm --quiet -q wlxjury
if [ $? = 0 ] ; then
rpm -e wlxjury
fi
rpm -i package/wlxjury-systemd-0.8.rpm
else
sbt run
fi