@@ -, +, @@ upgrading --- debian/koha-common.config | 16 +++++++++++++++- debian/koha-common.postinst | 5 +++-- 2 files changed, 18 insertions(+), 3 deletions(-) --- a/debian/koha-common.config +++ a/debian/koha-common.config @@ -42,7 +42,21 @@ fi db_input medium koha-common/automatically-update-translations || true -db_input high koha-common/rename-apache-vhost-files || true +# Determine if we should ask the user about upgrading - there's no point +# if this is a fresh install anyway. +if [ -e /usr/sbin/koha-list ]; then + 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 + db_input high koha-common/rename-apache-vhost-files || true + fi +fi db_go || true --- a/debian/koha-common.postinst +++ a/debian/koha-common.postinst @@ -109,10 +109,11 @@ EOF 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 + if [ ! -f "/etc/apache2/sites-enabled/$site" ]; then ENABLE_VHOST="no" fi + a2dissite $site > /dev/null 2>&1 || true + rm -f "/etc/apache2/sites-enabled/$site" # Rename the vhost definition files mv "/etc/apache2/sites-available/$site" \ "/etc/apache2/sites-available/$site.conf" --