[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#769322: dh_apache2 postinst.debhelper snipet must be after mv_conffile



Package: apache2
Version: 2.4.10-6

Hello

When I take a package that moves a file from conf.d to conf-available
though dh_installdeb and uses dh_apache2 I have:
- A package.maintscript with mv_conffile
- A package.apache2 with conf

The generated postinst.debhelper contains:
- First the apache2_invoke enconf
- Then the dpkg-maintscript-helper mv_conffile

But in postinst, mv_conffile calls finish_mv_conffile that does
echo "Preserving user changes to $NEWCONFFILE (renamed from
$OLDCONFFILE)..."
mv -f "$NEWCONFFILE" "$NEWCONFFILE.dpkg-new"
mv -f "$OLDCONFFILE" "$NEWCONFFILE

This means that the new apache configuration is put in place, then
apache is reloaded, then user changed file is restored in that place.
This result in the wrong conffile being used until/if apache is reloaded
after configuration of the package.



I tried moving dh_apache2 around debian/rules, but this looks impossible:

- The dh_apache2 part that create the /etc/apache2/conf-available/
conffile needs to be run before dh_installdeb or your get
file-in-etc-not-marked-as-conffile.

- The dh_apache2 postinst part that enable conf need to be run after
dh_installdeb or you enable the conffile and reload apache before the
finish_mv_conffile where user modified version of conffile is put in place.

I'll work around that by doing the "apache2_invoke enconf" manually
*after* #DEBHELPER#.


I'm attaching debhelper snipets as an example. I can see that preinst
and postinst order in not the same as prerm and postrm, so maybe there
is a solution...

-- Package-specific info:

-- System Information:
Debian Release: jessie/sid
  APT prefers testing
  APT policy: (990, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.16-3-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_GB.utf8, LC_CTYPE=en_GB.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages apache2 depends on:
ii  apache2-bin    2.4.10-6
ii  apache2-data   2.4.10-6
ii  apache2-utils  2.4.10-6
ii  lsb-base       4.1+Debian13+nmu1
ii  mime-support   3.57
ii  perl           5.20.1-2
ii  procps         2:3.3.9-8

Versions of packages apache2 recommends:
ii  ssl-cert  1.0.35

Versions of packages apache2 suggests:
pn  apache2-doc                                      <none>
pn  apache2-suexec-pristine | apache2-suexec-custom  <none>
ii  chromium [www-browser]                           38.0.2125.101-3
ii  iceweasel [www-browser]                          31.2.0esr-3
ii  lynx-cur [www-browser]                           2.8.9dev1-2+b1
ii  w3m [www-browser]                                0.5.3-19

Versions of packages apache2-bin depends on:
ii  libapr1                  1.5.1-3
ii  libaprutil1              1.5.4-1
ii  libaprutil1-dbd-sqlite3  1.5.4-1
ii  libaprutil1-ldap         1.5.4-1
ii  libc6                    2.19-13
ii  libldap-2.4-2            2.4.40-2
ii  liblua5.1-0              5.1.5-7.1
ii  libpcre3                 1:8.35-3.1
ii  libssl1.0.0              1.0.1j-1
ii  libxml2                  2.9.1+dfsg1-4
ii  perl                     5.20.1-2
ii  zlib1g                   1:1.2.8.dfsg-2

Versions of packages apache2-bin suggests:
pn  apache2-doc                                      <none>
pn  apache2-suexec-pristine | apache2-suexec-custom  <none>
ii  chromium [www-browser]                           38.0.2125.101-3
ii  iceweasel [www-browser]                          31.2.0esr-3
ii  lynx-cur [www-browser]                           2.8.9dev1-2+b1
ii  w3m [www-browser]                                0.5.3-19

Versions of packages apache2 is related to:
ii  apache2      2.4.10-6
ii  apache2-bin  2.4.10-6

-- Configuration Files:
/etc/apache2/mods-available/ident.load [Errno 2] No such file or
directory: u'/etc/apache2/mods-available/ident.load'

-- no debconf information
# Automatically added by dh_installdeb
dpkg-maintscript-helper mv_conffile /etc/ocsinventory/ocsreports.conf /etc/apache2/conf-available/ocsinventory-reports.conf 2.0.5-1.2~ -- "$@"
# End automatically added section
# Automatically added by dh_apache2
if true; then
	if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
		. /usr/share/apache2/apache2-maintscript-helper
		for conf in ocsinventory-reports  ; do
			apache2_invoke enconf $conf  || exit $?
		done
	fi
fi
# End automatically added section
# Automatically added by dh_installdeb
dpkg-maintscript-helper mv_conffile /etc/ocsinventory/ocsreports.conf /etc/apache2/conf-available/ocsinventory-reports.conf 2.0.5-1.2~ -- "$@"
# End automatically added section
# Automatically added by dh_installdeb
dpkg-maintscript-helper mv_conffile /etc/ocsinventory/ocsreports.conf /etc/apache2/conf-available/ocsinventory-reports.conf 2.0.5-1.2~ -- "$@"
# End automatically added section
# Automatically added by dh_apache2
if [ "$1" = "remove" ] || [ "$1" = "deconfigure" ] ; then
	if true; then
		if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
			. /usr/share/apache2/apache2-maintscript-helper

			for conf in ocsinventory-reports  ; do
				apache2_invoke disconf $conf  || exit $?
			done
		fi
	fi
fi
# End automatically added section
# Automatically added by dh_installdeb
dpkg-maintscript-helper mv_conffile /etc/ocsinventory/ocsreports.conf /etc/apache2/conf-available/ocsinventory-reports.conf 2.0.5-1.2~ -- "$@"
# End automatically added section
# Automatically added by dh_apache2
if [ "$1" = "purge" ] ; then
	if true; then
		if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
			. /usr/share/apache2/apache2-maintscript-helper

			for conf in ocsinventory-reports  ; do
				apache2_invoke disconf $conf  || exit $?
			done
		fi
	fi
fi
# End automatically added section

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: