diff options
author | Arno Töll <arno@debian.org> | 2013-05-20 13:50:02 +0200 |
---|---|---|
committer | Arno Töll <arno@debian.org> | 2013-05-20 13:50:02 +0200 |
commit | bad5e781e7ae521c5cc1b82d61049a6860c3b9bc (patch) | |
tree | 65c02d33fca9c5d502696eba465090d2e0609826 | |
parent | a193314e30e0e0a0d2b490a7105fc6c90cc69748 (diff) | |
download | apache2-bad5e781e7ae521c5cc1b82d61049a6860c3b9bc.tar.gz |
Hook dh_apache2 into postrm and prem
Purge state in postrm only
Let a2enmod purge state when calling -p for disabled modules
-rwxr-xr-x | debian/a2enmod | 3 | ||||
-rw-r--r-- | debian/apache2-dev.install | 1 | ||||
-rw-r--r-- | debian/changelog | 5 | ||||
-rw-r--r-- | debian/debhelper/apache2-maintscript-helper | 25 | ||||
-rwxr-xr-x | debian/debhelper/dh_apache2.in | 4 | ||||
-rw-r--r-- | debian/debhelper/postrm-apache2 | 11 |
6 files changed, 41 insertions, 8 deletions
diff --git a/debian/a2enmod b/debian/a2enmod index 1600790e..dd953e01 100755 --- a/debian/a2enmod +++ b/debian/a2enmod @@ -280,6 +280,9 @@ sub doit { } else { info("$name $acton already disabled\n"); + if ( $purge ) { + switch_marker( $obj, $act, $acton ); + } return 1; } } diff --git a/debian/apache2-dev.install b/debian/apache2-dev.install index 2f628cd9..eacb880b 100644 --- a/debian/apache2-dev.install +++ b/debian/apache2-dev.install @@ -5,3 +5,4 @@ debian/debhelper/dh_apache2 /usr/bin debian/debhelper/apache2.pm /usr/share/perl5/Debian/Debhelper/Sequence/ debian/debhelper/postinst-apache2 /usr/share/debhelper/autoscripts/ debian/debhelper/prerm-apache2 /usr/share/debhelper/autoscripts/ +debian/debhelper/postrm-apache2 /usr/share/debhelper/autoscripts/ diff --git a/debian/changelog b/debian/changelog index c1737bc9..c58bc4bd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -10,8 +10,11 @@ apache2 (2.4.4-3) UNRELEASED; urgency=low * Changes in dh_apache2: + Add -e|--noenable option to dh_apache2 (Closes: #681544) + Disable scripts in prerm, not postrm (Closes: #681546) + + However, still hook into postrm and purge state when required + Call the postinst code always, not only during configure (Closes: #681545) + * Let a2enmod purge state when calling -p for already disabled + configurations. * Fix "don't assume apache2 is running 24 hours a day when rotating logs": Only restart the webserver when it was previously running (Closes: #707892) @@ -30,7 +33,7 @@ apache2 (2.4.4-3) UNRELEASED; urgency=low fixed in 2.4. * Enable mod_authn_core when upgrading from wheezy (Closes: #702866) - -- Arno Töll <arno@debian.org> Tue, 14 May 2013 19:15:12 +0200 + -- Arno Töll <arno@debian.org> Mon, 20 May 2013 13:14:12 +0200 apache2 (2.4.4-2) experimental; urgency=low diff --git a/debian/debhelper/apache2-maintscript-helper b/debian/debhelper/apache2-maintscript-helper index e78a5de7..14a89084 100644 --- a/debian/debhelper/apache2-maintscript-helper +++ b/debian/debhelper/apache2-maintscript-helper @@ -363,16 +363,31 @@ apache2_invoke() apache2_msg "info" "apache2_invoke: Enable $invoke_string $CONF" ;; disconf|dismod|dissite) - if a2query $check_switch $CONF > /dev/null 2>&1 ; then + local a2query_ret=0 + a2query $check_switch "$CONF" > /dev/null 2>&1 || a2query_ret=$? + if [ "$a2query_ret" -eq 0 ] ; then if [ "$APACHE2_MAINTSCRIPT_NAME" = 'postrm' ] && [ "$APACHE2_MAINTSCRIPT_METHOD" = "purge" ] ; then a2$CMD -p -f -q "$CONF" || return 1 + apache2_msg "info" "apache2_invoke $APACHE2_MAINTSCRIPT_NAME: Purging $invoke_string $CONF" + APACHE2_NEED_ACTION=1 + elif [ "$APACHE2_MAINTSCRIPT_NAME" = 'postrm' ] || [ "$APACHE2_MAINTSCRIPT_NAME" = 'prerm' ] ; then + if [ "$APACHE2_MAINTSCRIPT_METHOD" = "remove" ] ; then + a2$CMD -m -f -q "$CONF" || return 1 + apache2_msg "info" "apache2_invoke $APACHE2_MAINTSCRIPT_NAME: Disable $invoke_string $CONF" + APACHE2_NEED_ACTION=1 + fi else - a2$CMD -m -f -q "$CONF" || return 1 + apache2_msg "error" "apache2_invoke: $invoke_string $CONF not supported in $APACHE2_MAINTSCRIPT_NAME" + return 1 + fi + elif [ "$a2query_ret" -eq 33 ] ; then + if [ "$APACHE2_MAINTSCRIPT_NAME" = 'postrm' ] && [ "$APACHE2_MAINTSCRIPT_METHOD" = "purge" ] ; then + apache2_msg "info" "apache2_invoke $APACHE2_MAINTSCRIPT_NAME: Purging state for $CONF" + a2$CMD -p -f -q "$CONF" || return 1 + APACHE2_NEED_ACTION=0 fi - APACHE2_NEED_ACTION=1 - apache2_msg "info" "apache2_invoke: Disable $invoke_string $CONF" else - apache2_msg "info" "apache2_invoke $CONF: No action required" + apache2_msg "info" "apache2_invoke $CONF $APACHE2_MAINTSCRIPT_NAME: No action required" fi ;; *) diff --git a/debian/debhelper/dh_apache2.in b/debian/debhelper/dh_apache2.in index 18f78bd7..293da12c 100755 --- a/debian/debhelper/dh_apache2.in +++ b/debian/debhelper/dh_apache2.in @@ -498,7 +498,7 @@ foreach my $package ((@{$dh{DOPACKAGES}})) { foreach my $ref (@postinst_autoscripts) { - for my $script_type (qw/postinst prerm/) + for my $script_type (qw/postinst prerm postrm/) { if ($script_type eq "postinst" && $dh{NOENABLE}) { @@ -513,7 +513,7 @@ foreach my $package ((@{$dh{DOPACKAGES}})) ACTION => $dh{RESTART}, ); - if ($script_type eq "prerm") + if ($script_type eq "prerm" || $script_type eq "postrm") { $replacements{'HELPER'} =~ s/en/dis/; } diff --git a/debian/debhelper/postrm-apache2 b/debian/debhelper/postrm-apache2 new file mode 100644 index 00000000..89ee4605 --- /dev/null +++ b/debian/debhelper/postrm-apache2 @@ -0,0 +1,11 @@ +if [ "$1" = "purge" ] ; then + if #CONDITIONAL_VARIABLE#; then + if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then + . /usr/share/apache2/apache2-maintscript-helper + + for conf in #NAMES# ; do + apache2_invoke #HELPER# $conf #ACTION# || #ERROR_HANDLER# + done + fi + fi +fi |