Skip to content
This repository was archived by the owner on Feb 14, 2024. It is now read-only.

Commit 3b68af8

Browse files
author
Darryl Weaver
committed
Fix for mysql on trusty master-relation-changed hook to handle apache 2.4 configuration files.
1 parent c5c7a67 commit 3b68af8

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

hooks/master-relation-changed

+11-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ ROOTARGS="-uroot -p`cat /var/lib/mysql/mysql.passwd`"
1010
snapdir=/var/www/snaps
1111
mkdir -p $snapdir
1212
apt-get -y install apache2
13+
APACHE_VERSION=`dpkg-query -W -f='${Version}\n' apache2 | cut -c1-3`
1314
# disable wide-open access (restrict to each db IP)
1415
rhosts=""
1516
remote_ip=""
@@ -31,7 +32,11 @@ done
3132
rhosts=${rhosts##,}
3233

3334
# 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
3540
cat > $target <<EOF
3641
DocumentRoot /var/www
3742
<Directory /var/www>
@@ -48,7 +53,11 @@ cat >> $target <<EOF
4853
</Directory>
4954
EOF
5055
a2ensite mysql-dumps
51-
a2dissite default
56+
if [ "$APACHE_VERSION" = "2.2" ] ; then
57+
a2dissite default
58+
else
59+
a2dissite 000-default
60+
fi
5261
service apache2 reload
5362

5463
pass=`pwgen -s 16`

revision

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
325
1+
326

0 commit comments

Comments
 (0)