Control: tags -1 + patch

Attached is a patch for that problem.

I believe it's important because there is a lot of packages that does not
depend on apache2, meaning they can be installed first, but that will install
some conffiles in /etc/apache/*-available/ as requested.

Note that "cut" will eat the error code, in the patch.
$ dpkg-query -f '${Package}\t${Status}\n'  -W 'apache2-mpm-*' 2>/dev/null | 
grep "XXXXXXX" | cut -f1 && echo cut eats errors
cut eats errors

Also tested ok if dpkg-query fails, when there is no 'apache2-mpm-*' packages 
for jessie upgrades.
diff --git a/debian/apache2.preinst b/debian/apache2.preinst
index c3e49c9..b8d8805 100644
--- a/debian/apache2.preinst
+++ b/debian/apache2.preinst
@@ -105,9 +105,8 @@ case "$1" in
 
 	# 1) an apache2-mpm package exists
 	if [ -d "/etc/apache2/" ] ; then
-		mpm=$(dpkg-query -f '${Package}\t${Status}\n'  -W 'apache2-mpm-*' 2>/dev/null) || true
-		if [ $? -eq 0 ] ; then
-			mpm=$(echo "$mpm" | grep "install ok" | cut -f1)
+		mpm=$(dpkg-query -f '${Package}\t${Status}\n'  -W 'apache2-mpm-*' 2>/dev/null | grep "install ok" | cut -f1)
+		if [ -n "$mpm" ] ; then
 			if [ ! -f /etc/apache2/.apache2_mpm_selected ] ; then
 				echo "# automatically created during upgrade" >> /etc/apache2/.apache2_mpm_selected
 				echo "# it can be safely removed anytime" >> /etc/apache2/.apache2_mpm_selected

Reply via email to