From f0c8824102ad7b817177b721b1c58e585b3e2ad8 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 25 Jul 2013 17:15:17 -0300 Subject: [PATCH] Bug 10646: mod_rewrite should be enabled by the postinst script This patch makes the post install scripts used by the .deb packages enable the mod_rewrite module (which is mandatory if you want to run Koha). It tests the module isn't already enabled, and enables if necesary, and reloads Apache configuration. To test: - Install current koha-common packages on a fresh setup. Make sure you have mod_rewrite disabled (its the default if you didn't have apache and it was just pulled by koha-common at least on Ubuntu 12.04). Run $ a2dismod rewrite to make sure it is disabled on your test box. Create a new koha instance like this: $ koha-create --create-db name You'll get an error like this: Syntax error on line 76 of /etc/koha/apache-shared.conf: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration Action 'configtest' failed. The Apache error log may have more information. ...fail! , build your own packages, make sure you have mod_rewrite disabled (which is the default on Ubuntu 12.04 at least), and install the package. Create a new instance issuing: - Apply the patch, build your packages, repeat: No apache warning about the rewrite module. Regards To+ Sponsored-by: Universidad Nacional de Cordoba Signed-off-by: Mirko Tietgen --- debian/koha-common.postinst | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/debian/koha-common.postinst b/debian/koha-common.postinst index 7fa4513..01fee33 100644 --- a/debian/koha-common.postinst +++ b/debian/koha-common.postinst @@ -4,6 +4,17 @@ set -e . /usr/share/debconf/confmodule +if apachectl -M 2> /dev/null | \ + grep -v -q "rewrite_module" ; then + + # mod_rewrite not enabled + a2enmod rewrite > /dev/null 2>&1 && + echo "mod_rewrite enabled" + # reload apache config + service apache2 reload + +fi + conf=/etc/mysql/koha-common.cnf if [ ! -e "$conf" ] && [ ! -L "$conf" ] then -- 1.7.2.5