[Pkg-apache-commits] [SCM] Debian packaging for apache2 (Apache HTTPD 2.x) branch, next, updated. 5d66df89987fdfd81300e67463f9cf10ee13ebc4
Arno Töll
arno at debian.org
Thu Apr 26 23:55:23 UTC 2012
The following commit has been merged in the next branch:
commit 5d66df89987fdfd81300e67463f9cf10ee13ebc4
Author: Arno Töll <arno at debian.org>
Date: Fri Apr 27 01:53:59 2012 +0200
* Implement -r (restart server) switch for dh_apache2
* Add a third (optional) attribute to apache2_invoke
* Remove break statements from apache2-maintscript-helper. In a shell case this
does not what I think it would.
diff --git a/debian/changelog b/debian/changelog
index ec12b3e..0035804 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -19,9 +19,15 @@ apache2 (2.4.2-2) experimental; urgency=low
* Change various state and run directories used by Apache from
/var/run/<basename> to /var/run/apache2/<basename>. This might change again
for Wheezy+1 to adopt /run.
- * Use more exit status codes for a2query, make its output more readable.
-
- -- Arno Töll <arno at debian.org> Thu, 26 Apr 2012 03:22:05 +0200
+ * Use more exit status codes for a2query which allows to tell apart why a
+ module was disabled, also make its output more readable.
+ * Fix several issues in apache2-maintscript-helper: Now apache2_invoke may
+ finally behave correctly and catch all cases including upgrades from
+ Squeeze. Also the rc.d action can be supplied through apache2_invoke now.
+ * Implement a -r switch for dh_apache2 which allows to force a reload of the
+ web server if required.
+
+ -- Arno Töll <arno at debian.org> Fri, 27 Apr 2012 01:52:38 +0200
apache2 (2.4.2-1) experimental; urgency=low
diff --git a/debian/debhelper/apache2-maintscript-helper b/debian/debhelper/apache2-maintscript-helper
index 48359c7..b09b724 100644
--- a/debian/debhelper/apache2-maintscript-helper
+++ b/debian/debhelper/apache2-maintscript-helper
@@ -19,7 +19,7 @@
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#XXX: Remove me later
-#set -x
+set -x
if [ -n "${EXPORT_APACHE2_MAINTSCRIPT_HELPER:-}" ] ; then
return
@@ -235,41 +235,55 @@ apache2_switch_mpm()
# Parameters:
# command - The command to invoke. Recognized commands are "enconf",
# "enmod", "ensite", "disconf", "dismod", "dissite"
-# argument - A single argument (e.g. a module) which shall be
-# enabled or disabled respectively. Do not enable module
-# dependencies that way, instead use module dependencies as
-# documented in </usr/share/doc/apache2/PACKAGING>.
-# Returns:
+# arguments
+# - A single argument (e.g. a module) which shall be
+# enabled or disabled respectively. Do not enable module
+# dependencies that way, instead use module dependencies as
+# documented in </usr/share/doc/apache2/PACKAGING>.
+# rcd-action
+# - An optional rc.d action to override the default which is to
+# reload the web server for sites and configurations but restart
+# it for modules. Recognized arguments are "restart" and "reload"
+# Returns
# 0 if the changes could be activated
# 1 otherwise
# Since: 2.4.1-3
+# Changes: 2.4.2-2: Added the second, optional argument
apache2_invoke()
{
local CMD=$1
local CONF=$2
+ local RCD_ACTION=$3
local invoke_rcd=0
local check_switch=""
local invoke_string=""
- local rcd_action=""
[ -x "/usr/sbin/a2$CMD" ] || return 1
[ -x "/usr/sbin/a2query" ] || return 1
+ case "${RCD_ACTION:-}" in
+ ""|reload|restart)
+ ;;
+ *)
+ return 1
+ ;;
+ esac
+
case "$CMD" in
*conf)
check_switch="-c"
invoke_string="configuration"
- rcd_action="reload"
+ rcd_action="${RCD_ACTION:-reload}"
;;
*mod)
check_switch="-m"
invoke_string="module"
- rcd_action="restart"
+ rcd_action="${RCD_ACTION:-restart}"
;;
*site)
check_switch="-s"
invoke_string="site"
- rcd_action="reload"
+ rcd_action="${RCD_ACTION:-reload}"
;;
*)
;;
@@ -296,7 +310,6 @@ apache2_invoke()
APACHE2_NEED_ACTION=1
a2$CMD -m -q "$CONF" > /dev/null 2>&1 || return 1
apache2_msg "info" "apache2_invoke: Enable $invoke_string $CONF"
- break
;;
disconf|dismod|dissite)
if a2query $check_switch $CONF > /dev/null 2>&1 ; then
@@ -311,7 +324,6 @@ apache2_invoke()
apache2_msg "info" "apache2_invoke $CONF: No action required"
continue
fi
- break
;;
*)
return 1
diff --git a/debian/debhelper/dh_apache2.in b/debian/debhelper/dh_apache2.in
index 7442d8e..d03f7e9 100755
--- a/debian/debhelper/dh_apache2.in
+++ b/debian/debhelper/dh_apache2.in
@@ -171,7 +171,7 @@ stanzas only
=head2 GLOBAL CONFIGURATION FILES
-Global configuration files (determined by hte B<conf> type) must have a I<.conf>
+Global configuration files (determined by the B<conf> type) must have a I<.conf>
suffix and are installed to I</etc/apache2/conf-available>. Moreover, the
configuration is activated in the maintainer script at installation time.
@@ -217,7 +217,7 @@ this type of configuration is found.
=item B<--error-handler=>I<function>
-Call the named shell I<function> if running the init script fails. The
+Call the named shell I<function> if running the maintainer script fails. The
function should be provided in the F<prerm> and F<postinst> scripts, before the
B<#DEBHELPER#> token.
@@ -228,15 +228,16 @@ true value at installation time. This is useful to web applications which want
to install Apache configuration files depending on a user input, for example if
they interface to the user through L<debconf(1)>.
-Defaults to B<true> and is subject to shell expansion (see Debian bug #660794 or
-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#>
+Defaults to B<true> and is subject to shell expansion (see Debian bug #660794
+which was reverted in a later debhelper version again). 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.
+In maintainer scripts, do not try to reload the web server, but restart it.
+Otherwise the default action is used, which means global configuration and
+sites make the web server to be reloaded on success, modules are restarted.
=item B<-n>, B<--noscripts>
@@ -302,13 +303,13 @@ if (!$dh{CONDITIONAL})
$dh{CONDITIONAL} = 'true';
}
-if (!$dh{RESTART})
+if ($dh{RESTART})
{
- $dh{RESTART} = 'reload';
+ $dh{RESTART} = 'restart';
}
else
{
- $dh{RESTART} = 'restart'
+ $dh{RESTART} = '';
}
foreach my $package (getpackages())
diff --git a/debian/debhelper/postinst-apache2 b/debian/debhelper/postinst-apache2
index 4f4e9b2..b833cbf 100644
--- a/debian/debhelper/postinst-apache2
+++ b/debian/debhelper/postinst-apache2
@@ -2,7 +2,7 @@ if [ "$1" = "configure" ] && #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 || #ERROR_HANDLER#
+ apache2_invoke #HELPER# $conf #ACTION# || #ERROR_HANDLER#
done
fi
fi
diff --git a/debian/debhelper/postrm-apache2 b/debian/debhelper/postrm-apache2
index ce8add8..f489eb9 100644
--- a/debian/debhelper/postrm-apache2
+++ b/debian/debhelper/postrm-apache2
@@ -4,7 +4,7 @@ if [ "$1" = "purge" ] || [ "$1" = "remove" ] ; then
. /usr/share/apache2/apache2-maintscript-helper
for conf in #NAMES# ; do
- apache2_invoke #HELPER# $conf || #ERROR_HANDLER#
+ apache2_invoke #HELPER# $conf #ACTION# || #ERROR_HANDLER#
done
fi
fi
--
Debian packaging for apache2 (Apache HTTPD 2.x)
More information about the Pkg-apache-commits
mailing list