summaryrefslogtreecommitdiff
path: root/debian/debhelper
diff options
context:
space:
mode:
authorArno Töll <arno@debian.org>2012-04-26 22:15:29 +0200
committerArno Töll <arno@debian.org>2012-04-26 23:23:24 +0200
commit99736d603d0a02a5c51783e4ae617699b7552440 (patch)
tree403e8e8806a33802c1d6a19c4278724769cfce6b /debian/debhelper
parent08c7718af9782d3fb4d8d307e9c4caf1f34ee950 (diff)
downloadapache2-99736d603d0a02a5c51783e4ae617699b7552440.tar.gz
* Add a -p|--purge option to a2enmod which purges the internal state data base
* Make use of --purge in apache2-maintscript-helper * Guess upgrades from a pre-maintscript version in apache2-maintscript-helper * Document -p switch in man pages
Diffstat (limited to 'debian/debhelper')
-rw-r--r--debian/debhelper/apache2-maintscript-helper24
-rwxr-xr-xdebian/debhelper/dh_apache2.in16
2 files changed, 31 insertions, 9 deletions
diff --git a/debian/debhelper/apache2-maintscript-helper b/debian/debhelper/apache2-maintscript-helper
index 02d7933f..b8fbdb24 100644
--- a/debian/debhelper/apache2-maintscript-helper
+++ b/debian/debhelper/apache2-maintscript-helper
@@ -173,7 +173,7 @@ apache2_has_module()
{
[ -x /usr/sbin/a2query ] || return 1
local MODULE="$1"
- if a2query -m "^$MODULE\$" > /dev/null ; then
+ if a2query -m "$MODULE" > /dev/null ; then
return 0
fi
@@ -261,11 +261,6 @@ apache2_invoke()
[ -x "/usr/sbin/a2$CMD" ] || return 1
[ -x "/usr/sbin/a2query" ] || return 1
- if ! apache2_needs_action ; then
- apache2_msg "info" "apache2_invoke $CONF: No action required"
- return 0
- fi
-
case "$CMD" in
*conf)
check_switch="-c"
@@ -286,9 +281,21 @@ apache2_invoke()
;;
esac
+ if ! apache2_needs_action ; then
+ # this is a trapdoor. Do act in any case we have no traces of
+ # the configuration. This might be the case for upgrades from
+ # Squeeze.
+ (a2query $check_switch "$CONF" > /dev/null 2>&1)
+ if [ ! "$?" -eq 1 ] ; then
+ apache2_msg "info" "apache2_invoke $CONF: No action required"
+ return 0
+ fi
+ fi
+
+
case "$CMD" in
enconf|enmod|ensite)
- if a2query $check_switch "^$CONF\$" > /dev/null 2>&1 ; then
+ if a2query $check_switch "$CONF" > /dev/null 2>&1 ; then
continue
fi
invoke_rcd=1
@@ -299,8 +306,7 @@ apache2_invoke()
if a2query $check_switch $CONF > /dev/null 2>&1 ; then
invoke_rcd=1
if [ "$APACHE2_MAINTSCRIPT_NAME" = 'postrm' ] && [ "$APACHE2_MAINTSCRIPT_METHOD" = "purge" ] ; then
- #XXX: Replace me by the "forget-state-switch" call
- a2$CMD -f -q "$CONF" || return 1
+ a2$CMD -p -f -q "$CONF" || return 1
else
a2$CMD -m -f -q "$CONF" || return 1
fi
diff --git a/debian/debhelper/dh_apache2.in b/debian/debhelper/dh_apache2.in
index 3b311878..7442d8ef 100755
--- a/debian/debhelper/dh_apache2.in
+++ b/debian/debhelper/dh_apache2.in
@@ -233,6 +233,11 @@ build-depend on debhelper >= 9.20120311 to avoid this problem). The expression
should be provided in the postrm and postinst scripts before the B<#DEBHELPER#>
token.
+=item S<B<--restart>> S<B<-r>
+
+In maintainer scripts, do not try to reload the web server, but restart it. The
+default is to reload it.
+
=item B<-n>, B<--noscripts>
Do not modify F<postinst>/F<postrm>/F<prerm> maintainer scripts.
@@ -289,6 +294,7 @@ This manual and L<dh_apache2> was written by Arno Toell <debian@toell.net>.
init(options => {
"conditional=s" => \$dh{CONDITIONAL},
+ "r|restart" => \$dh{RESTART},
});
if (!$dh{CONDITIONAL})
@@ -296,6 +302,15 @@ if (!$dh{CONDITIONAL})
$dh{CONDITIONAL} = 'true';
}
+if (!$dh{RESTART})
+{
+ $dh{RESTART} = 'reload';
+}
+else
+{
+ $dh{RESTART} = 'restart'
+}
+
foreach my $package (getpackages())
{
my %PACKAGE_TYPE = (
@@ -480,6 +495,7 @@ foreach my $package (getpackages())
NAMES => $ref->[1],
ERROR_HANDLER => $PACKAGE_TYPE{handler},
CONDITIONAL_VARIABLE => $PACKAGE_TYPE{conditional},
+ ACTION => $dh{RESTART},
);
if ($script_type eq "postrm")