debian-install: put pagespeed-libraries.conf where it will be loaded

The way you used to install apache2 configuration on Debian-based systems
was to put it in /etc/apache2/conf.d/, but starting with Ubuntu 14 LTS
there's a new system where you install it to /etc/apache2/conf-available/ and
then run a2enconf to symlink it to /etc/apache2/conf-enabled.  On these
systems we weren't installing pagespeed-libraries.conf in a way that made
it usable, because when we put it in conf.d it just was never loaded.

Switch to installing to /etc/apache2/conf-available/, and then use a2enconf
if it's available.  If a2enconf isn't available, manually symlink to conf.d.

Fixes: https://github.com/pagespeed/mod_pagespeed/issues/1389
This commit is contained in:
Jeff Kaufman
2016-09-26 18:58:57 -04:00
parent 1d1e02585f
commit 4e14d1fc85
4 changed files with 37 additions and 5 deletions
+6 -4
View File
@@ -46,7 +46,7 @@ prep_staging_debian() {
prep_staging_common
install -m 755 -d "${STAGEDIR}/DEBIAN" \
"${STAGEDIR}/etc/cron.daily" \
"${STAGEDIR}/etc/apache2/conf.d" \
"${STAGEDIR}${APACHE_CONF_AVAILABLE_DIR}" \
"${STAGEDIR}/usr/bin"
}
@@ -80,7 +80,7 @@ stage_install_debian() {
chmod 644 "${STAGEDIR}${APACHE_CONFDIR}/pagespeed.conf"
install -m 644 \
"${BUILDDIR}/../../net/instaweb/genfiles/conf/pagespeed_libraries.conf" \
"${STAGEDIR}${APACHE_CONF_D_DIR}/pagespeed_libraries.conf"
"${STAGEDIR}${APACHE_CONF_AVAILABLE_DIR}/pagespeed_libraries.conf"
}
# Build the deb file within a fakeroot.
@@ -248,12 +248,14 @@ export DEBEMAIL="${MAINTMAIL}"
# Make everything happen in the OUTPUTDIR.
cd "${OUTPUTDIR}"
COMMON_DEPS="apache2.2-common|apache2-api-20120211"
# Modules shouldn't generally depend on apache2, but to install ourselves we use
# a2enmod etc which are in the apache2 package.
COMMON_DEPS="apache2"
COMMON_PREDEPS="dpkg (>= 1.14.0)"
APACHE_MODULEDIR="/usr/lib/apache2/modules"
APACHE_CONFDIR="/etc/apache2/mods-available"
APACHE_CONF_D_DIR="/etc/apache2/conf.d"
APACHE_CONF_AVAILABLE_DIR="/etc/apache2/conf-available"
MOD_PAGESPEED_CACHE="/var/cache/mod_pagespeed"
MOD_PAGESPEED_LOG="/var/log/pagespeed"
APACHE_USER="www-data"
+1 -1
View File
@@ -1,3 +1,3 @@
/etc/apache2/mods-available/pagespeed.load
/etc/apache2/mods-available/pagespeed.conf
/etc/apache2/conf.d/pagespeed_libraries.conf
/etc/apache2/conf-available/pagespeed_libraries.conf
+20
View File
@@ -19,6 +19,26 @@ case "$1" in
test ! -e /etc/apache2/mods-enabled/pagespeed.load && \
a2enmod pagespeed
# Enable pagespeed-libraries.conf. On recent systems you install config
# files into /etc/apache2/conf-available and then use a2enconf to
# symlink it into /etc/apache2/conf-enabled. On older systems there's
# just /etc/apache2/conf.d/, so we manually symlink it there instead.
# See https://github.com/pagespeed/mod_pagespeed/issues/1389
if hash a2enconf 2> /dev/null; then
# a2enconf is available; use it.
a2enconf pagespeed_libraries
elif [ -d /etc/apache2/conf.d/ ]; then
# this ubuntu is too old for that; manually symlink it
if [ -e /etc/apache2/conf.d/pagespeed_libraries.conf ]; then
echo "Not symlinking on top of existing pagespeed_libraries.conf"
else
ln -s ../conf-available/pagespeed_libraries.conf \
/etc/apache2/conf.d/
fi
else
echo "failed to configure pagespeed_libraries.conf" >&2
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
+10
View File
@@ -3,6 +3,16 @@
case "$1" in
remove)
test -e /etc/apache2/mods-enabled/pagespeed.load && a2dismod pagespeed
if hash a2disconf 2> /dev/null; then
# a2disconf is available; use it.
test -L /etc/apache2/conf-enabled/pagespeed_libraries.conf && \
a2disconf pagespeed_libraries
else
# If we don't have a2disconf, then the symlink is in conf.d instead of
# conf-enabled.
test -L /etc/apache2/conf.d/pagespeed_libraries.conf && \
rm /etc/apache2/conf.d/pagespeed_libraries.conf
fi
;;
upgrade|deconfigure|failed-upgrade)
;;