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 <<EOM
+
+Koha requires mpm_itk to be enabled within Apache in order to run.
+Typically this can be enabled with:
+
+ $APACHE_DISABLE_MPM_MSG sudo a2enmod mpm_itk
+EOM
+
+ die
+ fi
+
+ # Check that mod_rewrite is installed and enabled.
+ if ! /usr/sbin/apachectl -M 2> /dev/null | grep -q 'rewrite_module'; then
+ cat 1>&2 <<EOM
+
+Koha requires mod_rewrite to be enabled within Apache in order to run.
+Typically this can be enabled with:
+
+ sudo a2enmod rewrite
+EOM
+ die
+ fi
+}
+
set_biblios_indexing_mode()
{
local indexing_mode=$1
Error: you provided memcached configuration switches but memcached is not enabled.
Please set USE_MEMCACHED="yes" on /etc/koha/koha-sites.conf or use the
---use-memcached optio switch to enable it.
+--use-memcached option switch to enable it.
EOF`
die "This script must be run with root privileges."
fi
-# Check that mod_rewrite is installed so we can bail out if it's not.
-if ! /usr/sbin/apachectl -M 2> /dev/null | grep -q 'rewrite_module'
-then
- cat 1>&2 <<EOM
-
-Koha requires mod_rewrite to be enabled within Apache in order to run.
-Typically this can be enabled with:
-
- sudo a2enmod rewrite
-EOM
- die
-fi
+# Check everything is ok with Apache, die otherwise
+check_apache_config
opacdomain="$OPACPREFIX$name$OPACSUFFIX$DOMAIN"
intradomain="$INTRAPREFIX$name$INTRASUFFIX$DOMAIN"
# Generate and install Apache site-available file and log dir.
generate_config_file apache-site.conf.in \
- "/etc/apache2/sites-available/$name"
+ "/etc/apache2/sites-available/$name.conf"
mkdir "/var/log/koha/$name"
chown "$username:$username" "/var/log/koha/$name"
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
disable_instance()
{
local instancename=$1
+ local instancefile="/etc/apache2/sites-available/$instancename.conf"
if is_enabled $instancename; then
sed -i 's:^\s*#\(\s*Include /etc/koha/apache-shared-disable.conf\)$:\1:' \
- "/etc/apache2/sites-available/$instancename"
+ "$instancefile"
return 0
else
return 1
chown "root:$name-koha" "$dbdump"
chmod g+r "$dbdump"
+instancefile="$name.conf"
# Dump configs, logs, etc.
metadump="$backupdir/$name-$date.tar.gz"
echo "* configs, logs to $metadump"
tar -C / -czf "$metadump" \
"etc/koha/sites/$name" \
- "etc/apache2/sites-available/$name" \
- "etc/apache2/sites-enabled/$name" \
+ "etc/apache2/sites-available/$instancefile" \
+ "etc/apache2/sites-enabled/$instancefile" \
"var/lib/koha/$name" \
"var/log/koha/$name"
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
enable_instance()
{
local instancename=$1
+ local instancefile="/etc/apache2/sites-available/$instancename.conf"
if ! is_enabled $instancename; then
sed -i 's:^\(\s*Include /etc/koha/apache-shared-disable.conf\)$:#\1:' \
- "/etc/apache2/sites-available/$instancename"
+ "$instancefile"
return 0
else
return 1
is_enabled()
{
local instancename=$1
+ local instancefile="/etc/apache2/sites-available/$instancename.conf"
if grep '^[[:space:]]*Include /etc/koha/apache-shared-disable.conf' \
- "/etc/apache2/sites-available/$instancename" > /dev/null
+ "$instancefile" > /dev/null
then
return 1
else
# 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" ] && \
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
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
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