~charmers/charms/trusty/mysql/trunk

« back to all changes in this revision

Viewing changes to hooks/master-relation-changed

  • Committer: Darryl Weaver
  • Date: 2014-08-13 22:58:04 UTC
  • mto: (120.6.1 mysql)
  • mto: This revision was merged to the branch mainline in revision 124.
  • Revision ID: darryl.weaver@canonical.com-20140813225804-jolrr2shqyiogxzq
Fix for mysql on trusty master-relation-changed hook to handle apache 2.4 configuration files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
snapdir=/var/www/snaps
11
11
mkdir -p $snapdir
12
12
apt-get -y install apache2
 
13
APACHE_VERSION=`dpkg-query -W -f='${Version}\n' apache2 | cut -c1-3`
13
14
# disable wide-open access (restrict to each db IP)
14
15
rhosts=""
15
16
remote_ip=""
31
32
rhosts=${rhosts##,}
32
33
 
33
34
# if there are no hosts, we simply disable all access
34
 
target=/etc/apache2/sites-available/mysql-dumps
 
35
if [ "$APACHE_VERSION" = "2.2" ] ; then
 
36
        target=/etc/apache2/sites-available/mysql-dumps
 
37
else
 
38
        target=/etc/apache2/sites-available/mysql-dumps.conf
 
39
fi
35
40
cat > $target <<EOF
36
41
DocumentRoot /var/www
37
42
<Directory /var/www>
48
53
</Directory>
49
54
EOF
50
55
a2ensite mysql-dumps
51
 
a2dissite default
 
56
if [ "$APACHE_VERSION" = "2.2" ] ; then
 
57
        a2dissite default
 
58
else
 
59
        a2dissite 000-default
 
60
fi
52
61
service apache2 reload
53
62
 
54
63
pass=`pwgen -s 16`