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

Re: Bug#830102: sitesummary: autopkgtest failure



On Wed, Aug 03, 2016 at 08:44:06AM +0200, Petter Reinholdtsen wrote:

> There is no way to know if 3 minutes is going to be enough, and a 
> simple reboot after installation might cause the at job to not be 
> executed.

Both cases could be dealt with, I guess:

diff --git a/debian/sitesummary.postinst b/debian/sitesummary.postinst
index 3401acf..98cd550 100644
--- a/debian/sitesummary.postinst
+++ b/debian/sitesummary.postinst
@@ -70,17 +70,31 @@ case "$1" in
         # Close debconf file handles before restarting Apache
         db_stop
 
-        # Enable it on fresh installations as before Apache 2.4.  Check for
-        # cgi.load existence to avoid trying to configure when installed after
-        # apache2 is unpacked but not yet configured (bug #760084).
-        if [ -z "$2" ] && \
-            [ -e /etc/apache2/mods-available/cgi.load ] && \
-            [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
-            . /usr/share/apache2/apache2-maintscript-helper
-            apache2_invoke enmod cgi.load
-            apache2_invoke enconf sitesummary.conf
-        fi
-
+        # Enable it on fresh installations as before Apache 2.4, but
+        # delay apache2 configuration for the case both packages are installed
+        # in parallel (workaround for bug #760084).
+	if [ -z "$2" ] && [ -e /etc/apache2/mods-available/cgi.load ] ; then
+	    a2enmod cgi
+	    a2enconf sitesummary
+	    service apache2 restart
+	fi
+	if [ -e /etc/apache2/mods-available/cgi.load.dpkg-new ] ; then
+	echo "while ! [ -e /etc/apache2/mods-available/cgi.load ] ; do" >> /tmp/atfile
+	echo "    sleep 2" >> /tmp/atfile
+	echo "done" >> /tmp/atfile
+	echo "if [ -e /etc/apache2/mods-available/cgid.load ] ; then" >> /tmp/atfile
+	echo "    a2enmod cgid" >> /tmp/atfile
+	echo "else" >> /tmp/atfile
+	echo "    a2enmod cgi" >> /tmp/atfile
+	echo "fi" >> /tmp/atfile
+	echo "a2enconf sitesummary" >> /tmp/atfile
+	echo "while ! [ -e /etc/init.d/apache2 ] ; do" >> /tmp/atfile
+	echo "    sleep 2" >> /tmp/atfile
+	echo "done" >> /tmp/atfile
+	echo "service apache2 restart" >> /tmp/atfile
+	echo "rm /tmp/atfile" >> /tmp/atfile
+	at -f /tmp/atfile now
+	fi
         # Make sure the cgi script can write to the storage area
 	chown www-data /var/lib/sitesummary/tmpstorage \
 	    /var/lib/sitesummary/entries

> Is there a way we could fix this by adding a dpkg trigger?  It was the 
> suggestion from the apt maintainers.
 
No idea how to implement it.

Wolfgang

Attachment: signature.asc
Description: Digital signature


Reply to: