-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap_dashboard.sh
executable file
·95 lines (76 loc) · 2.61 KB
/
bootstrap_dashboard.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
#!/bin/bash
#
# Bootstrap a CDash installation. The mysql data will live in /vagrant/mysql.
# Assume we are using a Ubuntu machine for the dashboard.
#
apt-get update
export DEBIAN_FRONTEND=noninteractive
#apt-get -y upgrade
apt-get -y -q install apache2 mysql-server php5 php5-mysql php5-xsl php5-curl php5-gd unzip git htop
#####
# Set the proper timezone.
#####
#echo "US/Mountain" | tee /etc/timezone
#dpkg-reconfigure --frontend noninteractive tzdata
#####
# Install CDash, configure mysql
#####
HTMLDIR="/var/www"
# Some linux distros use /var/www/html
if [ -d "/var/www/html" ]; then
HTMLDIR="/var/www/html"
fi
cd $HTMLDIR
echo '<?php' > $HTMLDIR/info.php
echo 'phpinfo();' >> $HTMLDIR/info.php
echo '?>' >> $HTMLDIR/info.php
###
# Check out and configure CDash, if need be.
###
if [ ! -f $HTMLDIR/CDash ]; then
# Stop mysql for the time being.
# stop mysql
git clone https://github.com/Kitware/CDash.git CDash
# Configure MySQL
# Add cdash database, user.
mysql -u root -e "create user 'cdash'@'%'"
mysql -u root -e "grant all on *.* to 'cdash'@'%'"
mysql -u root -e "create database cdash"
# If there is a default database file,
# import it into the database.
# Otherwise, create a script that lives in /home/vagrant
# that can be used to export the database file.
if [ -f /vagrant/default_cdash_database.sql.gz ]; then
echo "Importing pre-existing database."
gunzip < /vagrant/default_cdash_database.sql.gz | mysql -u root cdash
else
# Create a script for easy export of database, once it's been configured.
echo "You must configure a default database for use with CDash."
echo "Once created, run the script in /home/vagrant to"
echo "export it."
echo ""
fi
SQLSCRIPT="/home/vagrant/mysql_export.sh"
echo '#!/bin/bash' > $SQLSCRIPT
echo 'set -x' >> $SQLSCRIPT
echo "mysqldump -u root cdash | gzip > /home/vagrant/default_cdash_database.sql.gz" >> $SQLSCRIPT
echo "mv /home/vagrant/default_cdash_database.sql.gz /vagrant" >> $SQLSCRIPT
echo "echo Finished." >> $SQLSCRIPT
chmod 755 $SQLSCRIPT
chown vagrant:vagrant $SQLSCRIPT
apache2ctl restart
fi
chmod -R 777 $HTMLDIR/CDash
# Clone a base netcdf-c directory to work from and to monitor for changes.
if [ ! -d /vagrant/netcdf-c ]; then
VFILE="/vagrant/NETCDF_MISSING_RUNME.sh"
echo '#!/bin/bash' > $VFILE
echo 'git clone https://github.com/Unidata/netcdf-c' >> $VFILE
echo 'git clone https://github.com/Unidata/netcdf-fortran' >> $VFILE
echo 'rm $0' >> $VFILE
chmod 755 $VFILE
touch /vagrant/NOTEST
touch /vagrant/NOTESTF
fi
apache2ctl restart
exit 0