blob: c64ab4abee31fb783ef56ce64434a9373e2f7788 [file] [log] [blame]
#!/bin/sh
# Based on postinst from Chromium and Google Talk.
@@include@@../common/apt.include
MODPAGESPEED_ENABLE_UPDATES=@@MODPAGESPEED_ENABLE_UPDATES@@
case "$1" in
configure)
if [ -n "${MODPAGESPEED_ENABLE_UPDATES}" -a ! -e "$DEFAULTS_FILE" ]; then
echo 'repo_add_once="true"' > "$DEFAULTS_FILE"
echo 'repo_reenable_on_distupgrade="true"' >> "$DEFAULTS_FILE"
fi
# Run the cron job immediately to perform repository
# configuration.
nohup sh /etc/cron.daily/@@PACKAGE@@ > /dev/null 2>&1 &
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)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
exit 0