diff --git a/debian/scripts/koha-create b/debian/scripts/koha-create index 826163c573..a96cf3ebd2 100755 --- a/debian/scripts/koha-create +++ b/debian/scripts/koha-create @@ -123,6 +123,50 @@ getinstancemysqldatabase() { xmlstarlet sel -t -v 'yazgfs/config/database' "/etc/koha/sites/$1/koha-conf.xml" } +check_apache_config() +{ + + # Check that mpm_itk is installed and enabled + if ! /usr/sbin/apachectl -M 2> /dev/null | grep -q 'mpm_itk'; then + # Check Apache version + APACHE_DISABLE_MPM_MSG="" + if /usr/sbin/apache2ctl -v | grep -q "Server version: Apache/2.4"; then + # mpm_event or mpm_worker need to be disabled first. mpm_itk depends + # on mpm_prefork, which is enabled if needed. See + # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=734865 + if /usr/sbin/apachectl -M 2> /dev/null | grep -q 'mpm_event'; then + APACHE_DISABLE_MPM_MSG=" sudo a2dismod mpm_event ;" + elif /usr/sbin/apachectl -M 2> /dev/null | grep -q 'mpm_worker'; then + APACHE_DISABLE_MPM_MSG=" sudo a2dismod mpm_worker ;" + # else mpm_prefork: a2enmod mpm_itk works + fi + # else Apache 2.2: a2enmod mpm_itk works + fi + + cat 1>&2 < /dev/null | grep -q 'rewrite_module'; then + cat 1>&2 < /dev/null | grep -q 'rewrite_module' -then - cat 1>&2 < /dev/null + "$instancefile" > /dev/null then return 1 else diff --git a/debian/scripts/koha-remove b/debian/scripts/koha-remove index 3fa5ef167d..40bb3f6b6c 100755 --- a/debian/scripts/koha-remove +++ b/debian/scripts/koha-remove @@ -68,8 +68,11 @@ eof # If the daemon is not running already, we don't want to fail this loop. So bin the result code if this fails. koha-stop-zebra $name || /bin/true - [ -f "/etc/apache2/sites-available/$name" ] && \ - rm "/etc/apache2/sites-available/$name" + + instancefile="$name.conf" + + [ -f "/etc/apache2/sites-available/$instancefile" ] && \ + rm "/etc/apache2/sites-available/$instancefile" [ -f "/etc/koha/sites/$name/koha-conf.xml" ] && \ rm "/etc/koha/sites/$name/koha-conf.xml" [ -f "/etc/koha/sites/$name/zebra-biblios.cfg" ] && \ diff --git a/debian/scripts/koha-restart-zebra b/debian/scripts/koha-restart-zebra index 024251e95f..8b4b681fe8 100755 --- a/debian/scripts/koha-restart-zebra +++ b/debian/scripts/koha-restart-zebra @@ -32,13 +32,14 @@ warn() is_enabled() { local instancename=$1 + local instancefile="/etc/apache2/sites-available/$instancename.conf" if ! is_instance $instancename; then return 1 fi if grep -q '^[[:space:]]*Include /etc/koha/apache-shared-disable.conf' \ - "/etc/apache2/sites-available/$instancename" ; then + "$instancefile" ; then return 1 else return 0 diff --git a/debian/scripts/koha-start-zebra b/debian/scripts/koha-start-zebra index f63ab422bf..069b31abda 100755 --- a/debian/scripts/koha-start-zebra +++ b/debian/scripts/koha-start-zebra @@ -32,13 +32,14 @@ warn() is_enabled() { local instancename=$1 + local instancefile="/etc/apache2/sites-available/$instancename.conf" if ! is_instance $instancename; then return 1 fi if grep -q '^[[:space:]]*Include /etc/koha/apache-shared-disable.conf' \ - "/etc/apache2/sites-available/$instancename" ; then + "$instancefile" ; then return 1 else return 0 diff --git a/debian/scripts/koha-stop-zebra b/debian/scripts/koha-stop-zebra index e60f2b3789..2c8b726e78 100755 --- a/debian/scripts/koha-stop-zebra +++ b/debian/scripts/koha-stop-zebra @@ -32,13 +32,14 @@ warn() is_enabled() { local instancename=$1 + local instancefile="/etc/apache2/sites-available/$instancename.conf" if ! is_instance $instancename; then return 1 fi if grep -q '^[[:space:]]*Include /etc/koha/apache-shared-disable.conf' \ - "/etc/apache2/sites-available/$instancename" ; then + "$instancefile" ; then return 1 else return 0