From b7bbb1f289e278fee7f1b68a7cf52c63a68dbced Mon Sep 17 00:00:00 2001 From: Arno Töll Date: Wed, 7 Mar 2012 03:21:25 +0100 Subject: Add MPM transitional package * Add transitional packages for MPMs (except itk which breaks upgrades for users which did not have apache2 installed. On purpose? * Fix an evil bug in postinst [ -n $foo ] != [ -n "$foo" ] * Guess whether to enable mod_access_compat --- debian/apache2.postinst | 65 ++++++++++++++++++++++++++++++++++++------------- debian/apache2.preinst | 2 +- debian/control | 26 ++++++++++++++++---- 3 files changed, 70 insertions(+), 23 deletions(-) (limited to 'debian') diff --git a/debian/apache2.postinst b/debian/apache2.postinst index 8f48105f..8219e0e3 100755 --- a/debian/apache2.postinst +++ b/debian/apache2.postinst @@ -51,13 +51,13 @@ SQUEEZE_UPGRADE=0 # around or an /etc/apache2/.apache2_upgrade file exists. we_are_upgrading_from_squeeze() { - if [ -n $2 ] && dpkg --compare-versions "$2" le-nl "2.3"; then + if [ -n "$2" ] && dpkg --compare-versions "$2" le-nl "2.3"; then return 0 fi # this check is a probably tautology but makes it easier to understand # the logic - if [ -n $2 ] && dpkg --compare-versions "$2" ge-nl "2.3"; then + if [ -n "$2" ] && dpkg --compare-versions "$2" ge-nl "2.3"; then return 1 fi @@ -188,10 +188,15 @@ enable_default_mpm() } +#XXX: Modules which were enabled in 2.2 but aren't in 2.4 so far: +# env setenvif status auth_basic deflate +# authz_default authz_user authz_groupfile authn_file +# n.b. most of these modules are loaded as dependency if a module.conf file +# demands it. enable_default_modules() { if is_fresh_install $@ || we_are_upgrading_from_squeeze $@; then - for module in authz_host alias cgi dir ; do + for module in authz_host alias cgi dir autoindex mime negotiation ; do a2enmod -q $module done fi @@ -310,40 +315,66 @@ move_httpd_conf() migrate_data() { #XXX: jimjag recommends purging the cache albeit it is probably not - # technically required. + # technically required. + #if we_are_upgrading_from_squeeze $@ ; then + # # /var/cache/apache2/mod_disk_cache -> /var/cache/apache2/mod_cache_disk + # if [ -d /var/cache/apache2/mod_disk_cache ] && [ "$(ls -A /var/cache/apache2/mod_disk_cache)" ] ; then + # echo "Migrate mod_disk_cache cache data to /var/cache/apache2/mod_cache_disk/" + # mv /var/cache/apache2/mod_disk_cache/* /var/cache/apache2/mod_cache_disk/ + # rmdir /var/cache/apache2/mod_disk_cache + # fi + #fi if we_are_upgrading_from_squeeze $@ ; then - # /var/cache/apache2/mod_disk_cache -> /var/cache/apache2/mod_cache_disk - if [ -d /var/cache/apache2/mod_disk_cache ] && [ "$(ls -A /var/cache/apache2/mod_disk_cache)" ] ; then - echo "Migrate mod_disk_cache cache data to /var/cache/apache2/mod_cache_disk/" - mv /var/cache/apache2/mod_disk_cache/* /var/cache/apache2/mod_cache_disk/ - rmdir /var/cache/apache2/mod_disk_cache + if [ -d /var/cache/apache2/mod_disk_cache ] ; then + echo "Purge obsolete mod_disk_cache cache data in /var/cache/apache2/mod_cache_disk/" + rm -rf /var/cache/apache2/mod_disk_cache fi fi } -#XXX: Deal with the sites-available/sites-enabled *.conf transition, e.g. rename -# all files which look like site configuration? -#XXX: Re-enable modules which were enabled in 2.2 but aren't in 2.4 so far: -# autoindex env mime negotiation setenvif status auth_basic deflate -# authz_default authz_user authz_groupfile authn_file -# n.b. most of these modules are loaded as dependency if a module.conf file -# demands it. +guess_access_compat() +{ + if we_are_upgrading_from_squeeze $@ ; then + CONFS="" + if [ -f /etc/apache2/apache2.conf ] ; then + CONFS="/etc/apache2/apache2.conf" + fi + shopt -s nullglob + for confdir in /etc/apache2/sites-enabled /etc/apache2/conf-enabled /etc/apache2/mods-enabled ; do + if [ -d $confdir ] ; then + for conffile in $confdir/*.load ; do + CONFS="$CONFS $conffile" + done + fi + done + for conffile in $CONFS ; do + if grep -Ei "^\s*\b(Order|Allow|Deny)\b" $conffile > /dev/null ; then + echo "Enable mod_access_compat for Apache 2.2 compatibility" + a2enmod -q access_compat + return + fi + done + fi +} +#XXX: Deal with the sites-available/sites-enabled *.conf transition, e.g. rename +# all files which look like site configuration? case "$1" in configure) remove_conffiles $@ mv_conffiles $@ - refresh_modules $@ enable_default_mpm $@ + refresh_modules $@ install_default_files $@ enable_default_modules $@ enable_default_conf $@ install_default_site $@ move_httpd_conf $@ migrate_data $@ + guess_access_compat $@ # post installation cleanup if [ -e /etc/apache2/.apache2_mpm_selected ] ; then diff --git a/debian/apache2.preinst b/debian/apache2.preinst index 70472173..ce4f09c3 100644 --- a/debian/apache2.preinst +++ b/debian/apache2.preinst @@ -101,7 +101,7 @@ case "$1" in # black magic follows below. we're upgrading from Squeeze if # 1) an apache2-mpm package exists - if [ -n "$2" ] && [ -d "/etc/apache2/" ] ; then + if [ -d "/etc/apache2/" ] ; then mpm=$(dpkg-query -f '${Package}\t${Status}\n' -W 'apache2-mpm-*' 2>/dev/null) || true if [ $? -eq 0 ] ; then mpm=$(echo "$mpm" | grep "install ok" | cut -f1) diff --git a/debian/control b/debian/control index 5b912c3a..ee3736dc 100644 --- a/debian/control +++ b/debian/control @@ -62,11 +62,7 @@ Description: Apache HTTP Server (binary files and modules) instance. Do not install this package unless you want to set-up the Apache HTTP server entirely on your own. -Package: apache2-mpm -Provides: apache2-mpm-worker, apache2-mpm-prefork, apache2-mpm-event -Replaces: apache2-mpm-worker (<< 2.3~), apache2-mpm-prefork (<< 2.3~), apache2-mpm-event (<< 2.3~) -Breaks: apache2-mpm-worker (<< 2.3~), apache2-mpm-prefork (<< 2.3~), - apache2-mpm-event (<< 2.3~), apache2-mpm-itk (<< 2.3~) +Package: apache2-mpm-worker Architecture: any Section: oldlibs Priority: extra @@ -75,6 +71,26 @@ Description: transitional package for apache2 This is a transitional package for apache2, and can be safely removed after the installation is complete. +Package: apache2-mpm-prefork +Architecture: any +Section: oldlibs +Priority: extra +Depends: ${shlibs:Depends}, ${misc:Depends}, apache2 (= ${binary:Version}) +Description: transitional package for apache2 + This is a transitional package for apache2, and can be safely removed + after the installation is complete. + +Package: apache2-mpm-event +Architecture: any +Section: oldlibs +Priority: extra +Depends: ${shlibs:Depends}, ${misc:Depends}, apache2 (= ${binary:Version}) +Description: transitional package for apache2 + This is a transitional package for apache2, and can be safely removed + after the installation is complete. + +#XXX: apache2-mpm-itk transitional? + Package: apache2.2-bin Architecture: any Section: oldlibs -- cgit v1.2.3