[Pkg-apache-commits] [SCM] Debian packaging for apache2 (Apache HTTPD 2.x) branch, next, updated. a83dc57f213b3853074179b810c1989a4d0f7572
Arno Töll
debian at toell.net
Sat Feb 25 17:59:08 UTC 2012
The following commit has been merged in the next branch:
commit a83dc57f213b3853074179b810c1989a4d0f7572
Author: Arno Töll <debian at toell.net>
Date: Sat Feb 25 18:49:44 2012 +0100
Require a .conf suffix for site configuration
* Give files in sites-available a .conf suffix
* Handle conffile move properly
* Fix some bugs in the conffile movement
* Teach a2enmod how to enable files in sites-available with .conf suffix
* Update apache2.conf to include such files only, give a short summary how to
configure apache
* Simplify conffile migration handling
diff --git a/debian/a2enmod b/debian/a2enmod
index 027fe0a..74c49cb 100755
--- a/debian/a2enmod
+++ b/debian/a2enmod
@@ -49,7 +49,7 @@ elsif ( $obj eq 'conf' ) {
}
else {
$dir = 'sites';
- $sffx = '';
+ $sffx = '.conf';
$reload = 'reload';
}
$name = ucfirst($obj);
@@ -103,7 +103,6 @@ sub myglob {
my @glob = map {
s{^$choicedir/}{};
s{$sffx$}{};
- s{^000-default$}{default};
$_
} glob("$choicedir/$arg$sffx");
@@ -117,11 +116,6 @@ sub myglob {
sub doit {
my $acton = shift;
- my $prio = "";
- if ( $obj eq 'site' && $acton eq 'default' ) {
- $prio = '000-';
- }
-
my ( $conftgt, $conflink );
if ( $obj eq 'module' ) {
if ( $acton eq 'cgi' && threaded() ) {
@@ -136,7 +130,7 @@ sub doit {
}
my $tgt = "$availdir/$acton$sffx";
- my $link = "$enabldir/$prio$acton$sffx";
+ my $link = "$enabldir/$acton$sffx";
if ( !-e $tgt ) {
if ( -l $link && !-e $link ) {
diff --git a/debian/apache2.postinst b/debian/apache2.postinst
index 472d7ce..afd8a25 100755
--- a/debian/apache2.postinst
+++ b/debian/apache2.postinst
@@ -30,12 +30,14 @@ OBSOLETE_CONFFILES="/etc/apache2/mods-available/authz_default.load
/etc/apache2/mods-available/ident.load
/etc/apache2/mods-available/imagemap.load"
-MOVED_CONFFILES_IN="charset
-localized-error-pages
-other-vhosts-access-log
-security"
-MORE_MOVED_CONFFILES="/etc/bash_completion.d/apache2.2-common:/etc/bash_completion.d/apache2 "
+MOVED_CONFFILES="/etc/bash_completion.d/apache2.2-common:/etc/bash_completion.d/apache2
+/etc/apache2/sites-available/default:/etc/apache2/sites-available/000-default.conf
+/etc/apache2/sites-available/default-ssl:/etc/apache2/sites-available/default-ssl.conf
+/etc/apache2/conf.d/charset:/etc/apache2/conf-available/charset.conf
+/etc/apache2/conf.d/localized-error-pages:/etc/apache2/conf-available/localized-error-pages.conf
+/etc/apache2/conf.d/other-vhosts-access-log:/etc/apache2/conf-available/other-vhosts-access-log.conf
+/etc/apache2/conf.d/security:/etc/apache2/conf-available/security.conf"
# the functions below need to be idempotent, however we guess the upgrade based
@@ -68,8 +70,9 @@ we_are_upgrading_from_squeeze()
fi
done
- for CONFFILE in $MOVED_CONFFILES_IN ; do
- if [ -e "/etc/apache2/conf.d/$CONFFILE.dpkg-remove" ] ; then
+ for CONFFILE in $MOVED_CONFFILES ; do
+ OLDCONFFILE=$( echo "$CONFFILE" | cut -d: -f1 )
+ if [ -e "$OLDCONFFILE.dpkg-remove" ] ; then
SQUEEZE_UPGRADE=1
return 0
fi
@@ -105,12 +108,12 @@ mv_conffiles()
{
# same rationale as above
if we_are_upgrading_from_squeeze $@ ; then
- for CONFFILE in $MOVED_CONFFILES_IN ; do
- OLDCONFFILE="/etc/apache2/conf.d/$CONFFILE"
- NEWCONFFILE="/etc/apache2/conf-available/$CONFFILE.conf"
+ for CONFFILE in $MOVED_CONFFILES ; do
+ OLDCONFFILE=$( echo "$CONFFILE" | cut -d: -f1 )
+ NEWCONFFILE=$( echo "$CONFFILE" | cut -d: -f2 )
rm -f $OLDCONFFILE.dpkg-remove
- [ -e "$OLDCONFFILE" ] || return 0
+ [ -e "$OLDCONFFILE" ] || continue
echo "Preserving user changes to $NEWCONFFILE (renamed from $OLDCONFFILE)..."
mv -f "$NEWCONFFILE" "$NEWCONFFILE.dpkg-new"
@@ -126,19 +129,6 @@ mv_conffiles()
echo "Directory /etc/apache2/conf.d is not empty - leaving as is"
echo "Please note, that directory is considered obsolete and not read anymore by default"
fi
-
- for CONFFILE in $MORE_MOVED_CONFFILES ; do
- OLDCONFFILE=$( echo "$CONFFILE" | cut -d: -f1 )
- NEWCONFFILE=$( echo "$CONFFILE" | cut -d: -f2 )
-
- rm -f $OLDCONFFILE.dpkg-remove
- [ -e "$OLDCONFFILE" ] || return 0
-
- echo "Preserving user changes to $NEWCONFFILE (renamed from $OLDCONFFILE)..."
- mv -f "$NEWCONFFILE" "$NEWCONFFILE.dpkg-new"
- mv -f "$OLDCONFFILE" "$NEWCONFFILE"
-
- done
fi
}
@@ -191,15 +181,29 @@ enable_default_conf()
install_default_site()
{
-
- if [ ! -L /etc/apache2/sites-enabled/000-default -a \
- ! -f /etc/apache2/sites-enabled/000-default ]; then
- a2ensite -q default
- fi
-
- touch /var/log/apache2/error.log /var/log/apache2/access.log
- chown root:adm /var/log/apache2/error.log /var/log/apache2/access.log
- chmod 0640 /var/log/apache2/error.log /var/log/apache2/access.log
+ if we_are_upgrading_from_squeeze $@ ; then
+ # by here, the old default sites were already renamed. Thus, the links
+ # are dangling
+ for SITE in /etc/apache2/sites-enabled/000-default /etc/apache2/sites-enabled/default-ssl ; do
+ if [ -L $SITE ] ; then
+ target=$(readlink -e "$SITE") || true
+ sitename=$(basename "$SITE")
+ if [ -z $target ] ; then
+ rm -f $SITE
+ a2ensite -q $sitename
+ fi
+ fi
+ done
+ else
+ if [ ! -L /etc/apache2/sites-enabled/000-default.conf -a \
+ ! -f /etc/apache2/sites-enabled/000-default.conf ]; then
+ a2ensite -q 000-default
+ fi
+
+ touch /var/log/apache2/error.log /var/log/apache2/access.log
+ chown root:adm /var/log/apache2/error.log /var/log/apache2/access.log
+ chmod 0640 /var/log/apache2/error.log /var/log/apache2/access.log
+ fi
}
install_default_files()
@@ -226,7 +230,7 @@ refresh_modules()
echo "disable obsolete module $module"
a2dismod -q $module
- # XXX enable cache_disk if the used had
+ # XXX enable cache_disk if the user had
# disk_cache enabled
fi
# the module is already enabled, however
@@ -242,8 +246,10 @@ refresh_modules()
}
#XXX: Move /var/cache/apache2/mod_disk_cache to /var/cache/apache2/mod_cache_disk?
-#XXX: Move httpd.conf into conf.d if not empty, add comment what it used to be
-
+#XXX: Move httpd.conf into conf.d if not empty, add comment what it used to be.
+# Otherwise delete it
+#XXX: Deal with the sites-available/sites-enabled *.conf transition, e.g. rename
+# all files which look like site configuration?
case "$1" in
configure)
@@ -255,10 +261,7 @@ case "$1" in
install_default_files $@
enable_default_modules $@
enable_default_conf $@
-
- if [ -z "$2" ]; then
- install_default_site
- fi
+ install_default_site $@
# post installation cleanup
if [ -e /etc/apache2/.apache2_mpm_selected ] ; then
diff --git a/debian/apache2.postrm b/debian/apache2.postrm
index 3446923..d8076c6 100644
--- a/debian/apache2.postrm
+++ b/debian/apache2.postrm
@@ -30,13 +30,13 @@ OBSOLETE_CONFFILES="/etc/apache2/mods-available/authz_default.load
/etc/apache2/mods-available/ident.load
/etc/apache2/mods-available/imagemap.load"
-MOVED_CONFFILES_IN="charset
-localized-error-pages
-other-vhosts-access-log
-security"
-
-MORE_MOVED_CONFFILES="/etc/bash_completion.d/apache2.2-common:/etc/bash_completion.d/apache2"
-
+MOVED_CONFFILES="/etc/bash_completion.d/apache2.2-common:/etc/bash_completion.d/apache2
+/etc/apache2/sites-available/default:/etc/apache2/sites-available/000-default.conf
+/etc/apache2/sites-available/default-ssl:/etc/apache2/sites-available/default-ssl.conf
+/etc/apache2/conf.d/charset:/etc/apache2/conf-available/charset.conf
+/etc/apache2/conf.d/localized-error-pages:/etc/apache2/conf-available/localized-error-pages.conf
+/etc/apache2/conf.d/other-vhosts-access-log:/etc/apache2/conf-available/other-vhosts-access-log.conf
+/etc/apache2/conf.d/security:/etc/apache2/conf-available/security.conf"
case "$1" in
purge)
@@ -61,21 +61,7 @@ case "$1" in
fi
done
- for CONFFILE in $MOVED_CONFFILES_IN ; do
-
- CONFFILE="/etc/apache2/conf.d/$CONFFILE"
-
- if [ -e "$CONFFILE.dpkg-remove" ]; then
- echo "Reinstalling $CONFFILE that was moved away"
- mv "$CONFFILE.dpkg-remove" "$CONFFILE"
- fi
- if [ -e "$CONFFILE.dpkg-backup" ]; then
- echo "Reinstalling $CONFFILE that was backupped"
- mv "$CONFFILE.dpkg-backup" "$CONFFILE"
- fi
- done
-
- for CONFFILE in $MORE_MOVED_CONFFILES ; do
+ for CONFFILE in $MOVED_CONFFILES ; do
CONFFILE=$( echo "$CONFFILE" | cut -d: -f1 )
@@ -89,7 +75,6 @@ case "$1" in
fi
done
-
# post installation cleanup
if [ -e /etc/apache2/.apache2_mpm_selected ] ; then
rm -f /etc/apache2/.apache2_mpm_selected
diff --git a/debian/apache2.preinst b/debian/apache2.preinst
index a1129b8..7047217 100644
--- a/debian/apache2.preinst
+++ b/debian/apache2.preinst
@@ -28,17 +28,15 @@ OBSOLETE_CONFFILES="/etc/apache2/mods-available/authz_default.load
/etc/apache2/mods-available/ident.load
/etc/apache2/mods-available/imagemap.load"
-# these are all moved from /etc/apache2/conf.d/ to /etc/apache2/conf-available.
-# The scripts deal with that. Don't put any file in here which is located
-# somewhere else.
-MOVED_CONFFILES_IN="charset
-localized-error-pages
-other-vhosts-access-log
-security"
-
# conffiles which moved from one random location to another, separate source and
# destionation by a colon
-MORE_MOVED_CONFFILES="/etc/bash_completion.d/apache2.2-common:/etc/bash_completion.d/apache2"
+MOVED_CONFFILES="/etc/bash_completion.d/apache2.2-common:/etc/bash_completion.d/apache2
+/etc/apache2/sites-available/default:/etc/apache2/sites-available/000-default.conf
+/etc/apache2/sites-available/default-ssl:/etc/apache2/sites-available/default-ssl.conf
+/etc/apache2/conf.d/charset:/etc/apache2/conf-available/charset.conf
+/etc/apache2/conf.d/localized-error-pages:/etc/apache2/conf-available/localized-error-pages.conf
+/etc/apache2/conf.d/other-vhosts-access-log:/etc/apache2/conf-available/other-vhosts-access-log.conf
+/etc/apache2/conf.d/security:/etc/apache2/conf-available/security.conf"
obsolete_conffile_exists()
@@ -81,17 +79,11 @@ prepare_rm_conffile()
prepare_mv_conffile()
{
- for CONFFILE in $OBSOLETE_CONFFILES $MORE_MOVED_CONFFILES ; do
-
- if [[ ! $CONFFILE == "/*" ]] ; then
- CONFFILE="/etc/apache2/conf.d/$CONFFILE"
-
- else
- CONFFILE=$( echo "$CONFFILE" | cut -d: -f1 )
- fi
+ for CONFFILE in $MOVED_CONFFILES ; do
+ CONFFILE=$( echo "$CONFFILE" | cut -d: -f1 )
- [ -e "$CONFFILE" ] || return 0
+ [ -e "$CONFFILE" ] || continue
local md5sum="$(md5sum $CONFFILE | sed -e 's/ .*//')"
local old_md5sum="$(dpkg-query -W -f='${Conffiles}' apache2.2-common apache2 | \
diff --git a/debian/changelog b/debian/changelog
index 8c7a683..8c14881 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -58,6 +58,8 @@ apache2 (2.4.1-1) experimental; urgency=low
* Remove obsolete README.source file.
* Update doc-base metadata for the apache2-doc package
* Changes in the default configuration (not specific modules):
+ + On the head of the apache2.conf configuration file, give a short summary
+ how configuration of the Apache web server works in Debian.
+ Drop NameVirtualHost entirely. It is deprecated
+ Remove DefaultType. It is deprecated.
+ Replace Allow/Deny directives in the default configuration by using the
@@ -71,11 +73,16 @@ apache2 (2.4.1-1) experimental; urgency=low
Users can just load and unload MPMs like other modules, enable the worker
MPM by default
+ Move per-site global configuration from conf.d to conf-available and
- manage it similar to modules and sites. To do so, the new tools "a2enconf"
- and "a2disconf" are provided. Moreover, such configuration files need to
- have a .conf suffix now. The following configuration files are enabled
- bydefault: charset localized-error-pages other-vhosts-access-log security.
- These were enabled by default previously, too (Closes: #620347).
+ manage it similar to modules and sites. To do so, the new tools "a2enconf"
+ and "a2disconf" are provided. Moreover, such configuration files need to
+ have a .conf suffix now. The following configuration files are enabled
+ bydefault: charset localized-error-pages other-vhosts-access-log security.
+ These were enabled by default previously, too (Closes: #620347).
+ + Give site configuration a .conf suffix, too. For example the default vhost
+ is called default.conf. Moreover, files without .conf suffix are ignored
+ upon startup. Please update your site links and confs. Also rename the
+ default vhost to 000-default.conf and don't do hacky things in a2enmod
+ anymore.
* Changes in a2enmod:
+ Parse "Conflicts: " header to denote conflicts between modules which
cannot be loaded into the same Apache server.
@@ -83,6 +90,9 @@ apache2 (2.4.1-1) experimental; urgency=low
if they existed and only the "module.load" file was removed.
+ Extend the tool to support conf-available/conf-enabled directories (see
also configuration changes).
+ + Expect a .conf suffix for sites-enabled/sites-available configurations.
+ + Remove the default vhost special handling. Instead, we expect the default
+ host to be named appropripriately (e.g. 000-default.conf).
* The following modules and associated configuration files were removed:
+ mod_authz_default and mod_authn_default: Please use a proper
authentication module instead
@@ -112,7 +122,7 @@ apache2 (2.4.1-1) experimental; urgency=low
* Update bash completion functions to reflect the new site setup.
- -- Arno Töll <debian at toell.net> Sat, 25 Feb 2012 13:36:18 +0100
+ -- Arno Töll <debian at toell.net> Sat, 25 Feb 2012 18:47:15 +0100
apache2 (2.2.22-1) unstable; urgency=low
diff --git a/debian/config-dir/apache2.conf b/debian/config-dir/apache2.conf
index 57e9858..ac5d95c 100644
--- a/debian/config-dir/apache2.conf
+++ b/debian/config-dir/apache2.conf
@@ -1,28 +1,48 @@
-#
-# Based upon the NCSA server configuration files originally by Rob McCool.
-#
# This is the main Apache server configuration file. It contains the
# configuration directives that give the server its instructions.
# See http://httpd.apache.org/docs/2.4/ for detailed information about
# the directives.
#
-# Do NOT simply read the instructions in here without understanding
-# what they do. They're here only as hints or reminders. If you are unsure
-# consult the online docs. You have been warned.
#
-# Configuration and logfile names: If the filenames you specify for many
-# of the server's control files begin with "/" (or "drive:/" for Win32), the
-# server will use that explicit path. If the filenames do *not* begin
-# with "/", the value of ServerRoot is prepended -- so
-# "/var/log/apache2/foo_log"
-# with ServerRoot set to "" will be interpreted by the
-# server as "//var/log/apache2/foo_log".
+# Summary how Apache configuration works in Debian:
+# The Apache web server configuration is splitted into several files which are
+# read by the web server upon startup. The hierarchical overview is as follows:
+#
+# /etc/apache2/
+# |-- apache2.conf
+# | `-- ports.conf
+# |-- mods-enabled
+# | |-- *.load
+# | |-- *.conf
+# |-- conf-enabled
+# | |-- *.conf
+# |-- sites-enabled
+# | |-- *.conf
+#
+#
+# All configuration files are located in the /etc/apache2/ directory.
+#
+# * apache2.conf is the main configuration file. It will include all enabled
+# configuration files on startup
+#
+# * ports.conf is included from the main configuration file unconditionally. It
+# is supposed to configure listening ports for incoming connections.
+#
+# * File in various *-enabled directories outlined above are configuration
+# snippets which manage modules, global configuration fragments or site
+# specific configuration respectively. They are activated by symlinking
+# available configuration files from their respective *-available
+# counterparts. Please do not (un-)set links manually, instead use our
+# helpers a2enmod/a2dismod, a2ensite/a2dissite and a2enconf/a2disconf.
+#
+# * The binary is called apache2, However, instead of using it directly you
+# should use apache2ctl to control the server instead as we are using
+# expansion variables by default.
+#
+# See the full documentation in /usr/share/doc/apache2/README.Debian
-### Section 1: Global Environment
#
-# The directives in this section affect the overall operation of Apache,
-# such as the number of concurrent requests it can handle or where it
-# can find its configuration files.
+# Global configuration
#
#
@@ -162,4 +182,4 @@ LogFormat "%{User-agent}i" agent
IncludeOptional conf-enabled/*.conf
# Include the virtual host configurations:
-IncludeOptional sites-enabled/*
+IncludeOptional sites-enabled/*.conf
diff --git a/debian/config-dir/sites-available/default b/debian/config-dir/sites-available/000-default.conf
similarity index 100%
rename from debian/config-dir/sites-available/default
rename to debian/config-dir/sites-available/000-default.conf
diff --git a/debian/config-dir/sites-available/default-ssl b/debian/config-dir/sites-available/default-ssl.conf
similarity index 100%
rename from debian/config-dir/sites-available/default-ssl
rename to debian/config-dir/sites-available/default-ssl.conf
--
Debian packaging for apache2 (Apache HTTPD 2.x)
More information about the Pkg-apache-commits
mailing list