-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ehem,
forgot the patch ;-)


- -- 
mit freundlichen Grüßen,
Arno Töll
GnuPG Key-ID: 0x8408D4C4
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJNoZKqAAoJELBdpXvEXpo9Xk8P/37uSVbmNqVO/AOgQ9C7SogV
9kh0kbEcQxnal+u5e5KZJBb/ozvx/mW8/RAwwoY1OED0I4AASV86RMG+seMhHBqQ
PIRpiJlXa0IkJhyUnR5UoaJbV+uea6GlwiTbmmfv0J9drLUw8b/V64exi7yFI7+m
TMTLMPe/fnRXdBfue0vJ5Y6B0uwygvzW5QW/KSK309XG2V6B3CVl/NYs9N+uUoz6
zC/JPXTvPohdgsfG+x2YUvf8xaicl6DFbqRAJuuhK/iKKsQ4uhFeBM8bJnIK8I1e
Bs/XcU7HoSfJSZxYaZgdIwSHApJlhxybtRpJTxud5gkAw0rB1oWpnpGsMR8K/rY3
smupRdH0esu7oFR6l+ht5JzXVD+rNhmjXt+ULiOHF5QA74fU2yykJxa32O1LJjOH
SPx+KFFySKVOPY4mXX+It2wVXfBTOOCo/2UnSLcA2G5UHWp7W/iXGr14QqB8OUAR
Gg1FvEI8A8B8OTIJ5erau3sWYWAsKtPvs2eMS4OzoaYbR/XnIY3uQyqIkEWCu7VF
/2oAgDoLUeARLT80nhmkStUE51TeNdHxn3ty12vaXf12uoQZ0tHlRUtkEMKxUGiP
eEiNB4WbkuAPFCmBpTRjORo0/U3SGuzIEkCqe7vzKZ59yAXq/aZBILj3J7zEWUnP
oLFBZyTE2Pfsu/gH8QOG
=iwDX
-----END PGP SIGNATURE-----
Index: debian/lighty-enable-mod
===================================================================
--- debian/lighty-enable-mod	(revision 525)
+++ debian/lighty-enable-mod	(working copy)
@@ -4,6 +4,7 @@
 #
 #	Contains changes from:
 #		- Tobias Gruetzmacher <tob...@portfolio16.de>
+#		- Arno Toell <deb...@toell.net>
 #
 #	You may distribute under the terms of either the GNU General Public
 #	License[1] or the Artistic License[2].
@@ -23,7 +24,6 @@
 my %available = ();
 my %enabled = ();
 my @todo = ();
-my %moduledeps = ();
 my $enabling = 1;
 
 #--- first check if we enabling or disabling
@@ -75,16 +75,43 @@
 #--- activate (link) or deactivate (remove) module
 foreach my $do (@todo) {
 
+	if (! exists($available{$do})) {
+		print("Ignoring unknown module: $do\n");
+		next;
+	}
 
 	if ($enabling) {
 		next unless defined($available{$do});
 		my $target = sprintf("%s/conf-enabled/%s", $confdir,basename($available{$do}));
-		print qq{Enabling $do: };
+		my $source = $available{$do};
 
 		my $st = stat($target);
 		unless ( -f $target ) {
+			# scan for a dependency line
+			local *MOD;
+			open(MOD, "< $source") || die("can't read $source: $!");
+			while(my $i = <MOD>) {
+				if ($i =~ m/# -\*- depends: ([-\w, ]+) -\*-/) {
+					my @matches = split(/,\s+/, $1);
+					for my $module (@matches) {
+						if (exists $available{$module} and ! exists $enabled{$module}) {
+							print("Met dependency: $module\n");
+							push(@todo, $module);
+						}
+						elsif (exists $available{$module} and exists $enabled{$module}) {
+							# Do nothing
+						}
+						else
+						{
+							die("Unresolved dependency: $module\n");
+						}
+					}
+					last;
+				}
+			}
+			close(MOD);
 			if (symlink("../conf-available/" . basename($available{$do}), $target)) {		
-				print "ok\n";
+				print "Enabling $do: ok\n";
 			}
 			else {
 				print "failure: $!\n";
@@ -94,19 +121,35 @@
 			print "already enabled\n";
 		}
 
-		#--- check dependencies
-		for my $module (@{$moduledeps{$do}})
-		{
-			unless ( -f $target && -l $target )
-			{
-				print qq{Module $do depends on module $module which is not activated.\n};
-			}
-		}
 	}
 	else {
 		if (defined($enabled{$do})) {
 			print qq{Disabling $do\n};
 			my $target = sprintf("%s/conf-enabled/%s", $confdir,basename($enabled{$do}));
+			my $source = $available{$do};
+		
+			# scan for a reverse dependency line
+			foreach my $available_module (keys %available) {
+				if ($available_module eq $do) {
+					next;
+					}
+				local *MOD;
+				open(MOD, "< $available{$available_module}") || die("can't read $available{$available_module}: $!");
+				while(my $i = <MOD>) {
+					if ($i =~ m/# -\*- depends: ([-\w, ]+) -\*-/) {
+						my @matches = split(/,\s+/, $1);
+						for my $module (@matches) {
+						if ($module eq $do && exists $enabled{$available_module}) {
+							print("Reverse dependency met: Disabling $available_module too\n");
+							push(@todo, $available_module);
+							}
+						}
+					last;
+					}
+				}				
+			}
+			close(MOD);
+
 			unlink($target);
 		} else {
 			print qq{Already disabled $do\n};
Index: debian/changelog
===================================================================
--- debian/changelog	(revision 525)
+++ debian/changelog	(working copy)
@@ -1,3 +1,13 @@
+lighttpd (1.4.28-4) unstable; urgency=low
+
+  * Fix "leaves dangling alternatives on upgrade" add preinst script which
+    removes the dangling symlink (Closes: #614716)
+  * Fix "/etc/lighttpd/conf-available/15-fastcgi-php.conf: fastcgi-php
+    file missing a required directive" add a dependency based recursive module
+    enable system in lighty-enable-mod (Closes: #600050)
+
+ -- XXXXXX <xx...@yyyyy.tld>  Sat, 09 Apr 2011 13:22:45 -0400
+
 lighttpd (1.4.28-3) unstable; urgency=low
 
   [ Krzysztof Krzyżaniak (eloy) ]
Index: debian/rules
===================================================================
--- debian/rules	(revision 525)
+++ debian/rules	(working copy)
@@ -1,5 +1,7 @@
 #!/usr/bin/make -f
+export DH_VERBOSE=1
 
+
 %:
 	dh $@
 
Index: debian/lighttpd.preinst
===================================================================
--- debian/lighttpd.preinst	(revision 0)
+++ debian/lighttpd.preinst	(revision 0)
@@ -0,0 +1,47 @@
+#!/bin/sh
+# preinst script for lighttpd
+
+
+set -e
+
+# summary of how this script can be called:
+#        * <new-preinst> `install'
+#        * <new-preinst> `install' <old-version>
+#        * <new-preinst> `upgrade' <old-version>
+#        * <old-preinst> `abort-upgrade' <new-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+	install)
+	;;
+
+	upgrade)
+
+	if [ "x$2" != "x" ]; then	
+		# We upgrade from Squeeze or older, remove alternative as spawn-fcgi is not provided anymore.
+		# This should have been done since 1.4.26-1 but was accidentally forgotten		
+		if dpkg --compare-versions "$2" lt 1.4.28-4
+		then
+			update-alternatives --remove spawn-fcgi /usr/bin/spawn-fcgi.lighttpd || true
+			update-alternatives --remove spawn-fcgi.1.gz /usr/share/man/man1/spawn-fcgi.lighttpd.1.gz || true
+		fi
+
+	fi
+	;;
+
+	abort-upgrade)
+	;;
+	
+	*)
+	echo "preinst called with unknown argument \`$1'" >&2
+	exit 1
+	;;
+esac
+
+#DEBHELPER#
+
+exit 0
+
+
Index: debian/conf-available/15-fastcgi-php.conf
===================================================================
--- debian/conf-available/15-fastcgi-php.conf	(revision 525)
+++ debian/conf-available/15-fastcgi-php.conf	(working copy)
@@ -1,3 +1,4 @@
+# -*- depends: fastcgi -*-
 # /usr/share/doc/lighttpd-doc/fastcgi.txt.gz
 # http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ConfigurationOptions#mod_fastcgi-fastcgi
 

Reply via email to