Bug 11404: Make the install process aware of the changes

This patch makes the install scripts take care of the new file
and prompt for user confirmation on the apache file renaming step.

Both prompt and the renaming actions depend on the fact that there
are instances with their files missing the .conf appendix.

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Robin Sheat <robin@catalyst.net.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
Tomás Cohen Arazi 2014-05-06 15:13:19 -03:00 committed by Galen Charlton
parent 92c7653071
commit 624c953b35
4 changed files with 60 additions and 0 deletions

View file

@ -42,5 +42,7 @@ fi
db_input medium koha-common/automatically-update-translations || true
db_input high koha-common/rename-apache-vhost-files || true
db_go || true

View file

@ -7,6 +7,7 @@ debian/koha-post-install-setup usr/sbin
debian/unavailable.html usr/share/koha/intranet/htdocs
debian/unavailable.html usr/share/koha/opac/htdocs
debian/templates/* etc/koha
debian/scripts/koha-functions.sh usr/share/koha/bin
debian/scripts/koha-create usr/sbin
debian/scripts/koha-create-dirs usr/sbin
debian/scripts/koha-disable usr/sbin

View file

@ -78,6 +78,55 @@ EOF
fi
fi
# Check if we need to rename the Apache vhost files
RENAME_APACHE_FILES="no"
for vhost in $(koha-list); do
if [ -f "/etc/apache2/sites-available/$vhost" ] && \
[ ! -f "/etc/apache2/sites-available/$vhost.conf" ]; then
RENAME_APACHE_FILES="yes"
break # at least one, trigger renaming
fi
done
if [ "$RENAME_APACHE_FILES" = "yes" ]; then
# If the user agreed we now rename their Apache files
db_get koha-common/rename-apache-vhost-files
if [ "$RET" = "false" ]; then
# We're not renaming the files, just print a warning
cat <<EOF >&2
Warning: you have chosen not to migrate your Apache virtual hosts files to the
Apache 2.4 naming schema. You can do it manually by running this for each
Koha instance:
$ sudo a2dissite instance
$ sudo mv /etc/apache2/sites-available/instance \
/etc/apache2/sites-available/instance.conf
$ sudo a2ensite instance
EOF
else
# We have to rename the Apache files
for site in $(koha-list); do
ENABLE_VHOST="yes"
if [ -f "/etc/apache2/sites-available/$site" ] && \
[ ! -f "/etc/apache2/sites-available/$site.conf" ]; then
if ! a2dissite $site > /dev/null 2>&1; then
echo "Warning: problem disabling $site in Apache" >&2
ENABLE_VHOST="no"
fi
# Rename the vhost definition files
mv "/etc/apache2/sites-available/$site" \
"/etc/apache2/sites-available/$site.conf"
if [ "$ENABLE_VHOST" = "yes" ]; then
if ! a2ensite $site > /dev/null 2>&1; then
echo "Warning: problem enabling $site in Apache" >&2
fi
fi
fi
done
fi
fi
db_stop
exit 0

View file

@ -15,3 +15,11 @@ Default: true
Description: automatically update translations
When Koha is upgraded, any existing translated templates can be regenerated
to keep everything in sync. Select "yes" if you want this.
Template: koha-common/rename-apache-vhost-files
Type: boolean
Default: true
Description: Rename the Apache virtual hosts files for Koha instances?
When Koha is upgraded, the Apache's virtual host definition files can be
renamed to match the needs of the newer Apache 2.4. Previously defined
Koha instances will get their Apache files appended '.conf'.