[Initscripts-ng-commits] r391 - in /trunk/src/insserv/debian: changelog check-initd-order update-bootsystem-insserv

pere at users.alioth.debian.org pere at users.alioth.debian.org
Tue Jan 1 11:08:32 UTC 2008


Author: pere
Date: Tue Jan  1 11:08:30 2008
New Revision: 391

URL: http://svn.debian.org/wsvn/initscripts-ng/?sc=1&rev=391
Log:
  * Try to make recovery routine more robust by not trying to run
    non-existing postinst scripts, and only run postinst scripts for
    packages with executable scripts in /etc/init.d/.
  * Extended check-initd-order to check optional start dependencies,
    and implement check of the shutdown sequence.

Modified:
    trunk/src/insserv/debian/changelog
    trunk/src/insserv/debian/check-initd-order
    trunk/src/insserv/debian/update-bootsystem-insserv

Modified: trunk/src/insserv/debian/changelog
URL: http://svn.debian.org/wsvn/initscripts-ng/trunk/src/insserv/debian/changelog?rev=391&op=diff
==============================================================================
--- trunk/src/insserv/debian/changelog (original)
+++ trunk/src/insserv/debian/changelog Tue Jan  1 11:08:30 2008
@@ -9,6 +9,11 @@
     and the package.
   * Added override file for racoon, and corrected override file for
     setkey, after checking the scripts in the package.
+  * Try to make recovery routine more robust by not trying to run
+    non-existing postinst scripts, and only run postinst scripts for
+    packages with executable scripts in /etc/init.d/.
+  * Extended check-initd-order to check optional start dependencies,
+    and implement check of the shutdown sequence.
 
  -- Petter Reinholdtsen <pere at debian.org>  Mon, 31 Dec 2007 19:26:00 +0100
 

Modified: trunk/src/insserv/debian/check-initd-order
URL: http://svn.debian.org/wsvn/initscripts-ng/trunk/src/insserv/debian/check-initd-order?rev=391&op=diff
==============================================================================
--- trunk/src/insserv/debian/check-initd-order (original)
+++ trunk/src/insserv/debian/check-initd-order Tue Jan  1 11:08:30 2008
@@ -57,6 +57,7 @@
      'portmap'      => '$portmap',
      );
 
+my %provideslist;
 my %scriptorder;
 my %opts;
 
@@ -169,78 +170,108 @@
 EOF
 }
 
+sub check_deps {
+    my ($lsbinforef, $tag, $order, $bootorder, $headername, $required) = @_;
+    my %lsbinfo = %{$lsbinforef};
+    my $name = $lsbinfo{'file'};
+    if ($lsbinfo{$headername}) {
+        my @depends = split(/\s+/, $lsbinfo{$headername});
+        for my $dep (@depends) {
+            if (! $required && exists $provideslist{$dep}) {
+                unless (exists $scriptorder{$tag}{$dep}
+                        and ("S" eq $tag
+                             ? $scriptorder{$tag}{$dep} < $bootorder
+                             : $scriptorder{$tag}{$dep} > $bootorder)) {
+                    my $deporder;
+                    if (exists $scriptorder{$tag}{$dep}) {
+                        $deporder = $scriptorder{$tag}{$dep}
+                    } else {
+                        $deporder = exists $provideslist{$dep} ? $provideslist{$dep} : "?";
+                    }
+                    print "Incorrect order " .
+                        "$dep\@$deporder > $name\@$order\n";
+                }
+            }
+        }
+    }
+}
+
 sub check_bootorder {
     my $bootorder = 0;
     my @dirs = $opts{'k'} ? $rcmap{6} : ($rcmap{S}, $rcmap{2});
+    my @scripts;
     for my $rcdir (@dirs) {
-        chdir "$rcbase/$rcdir/.";
-        my @scripts = $opts{'k'} ? <K*> : <S*>;
-
-        if ($opts{'k'}) {
-            $scriptorder{'K'}{'$all'} = 1;
-        } else {
-            # Calculate script order for the script before the scripts
-            # with the last boot sequence number.
-            my $tmpbootorder = 0;
-            my $allorder = 0;
-            my $maxorder = 0;
-            my $maxbootorder = 0;
-            for my $script (@scripts) {
-                $tmpbootorder++;
-                my ($tag, $order, $name) = $script =~ m/^(.)(\d{2})(.+)$/;
-                if ($order > $maxorder) {
-                    $allorder = $maxbootorder;
-                    $maxbootorder = $tmpbootorder;
-                    $maxorder = $order;
+#        chdir "$rcbase/$rcdir/.";
+        push(@scripts, $opts{'k'} ? <$rcbase/$rcdir/K*> : <$rcbase/$rcdir/S*>);
+    }
+
+    if ($opts{'k'}) {
+        $scriptorder{'K'}{'$all'} = 1;
+    } else {
+        # Calculate script order for the script before the scripts
+        # with the last boot sequence number.
+        my $tmpbootorder = 0;
+        my $allorder = 0;
+        my $maxorder = 0;
+        my $maxbootorder = 0;
+        for my $scriptpath (@scripts) {
+            my $script = $scriptpath;
+            $script =~ s%^.*/([^/]+)$%$1%;
+            $tmpbootorder++;
+            my ($tag, $order, $name) = $script =~ m/^(.)(\d{2})(.+)$/;
+            if ($order > $maxorder) {
+                $allorder = $maxbootorder;
+                $maxbootorder = $tmpbootorder;
+                $maxorder = $order;
+            }
+
+            my $lsbinforef = load_lsb_tags($scriptpath,
+                                           $useoverrides);
+
+            if (exists $lsbinforef->{'provides'}) {
+                for my $provide (split(/\s+/, $lsbinforef->{'provides'})) {
+                    $provideslist{$provide} = $order;
                 }
-            }
-            $scriptorder{'S'}{'$all'} = $allorder;
-        }
-        for my $script (@scripts) {
-            $bootorder++;
-            my ($tag, $order, $name) = $script =~ m/^(.)(\d{2})(.+)$/;
-
-            $scriptorder{$tag}{$name} = $bootorder;
-            $scriptorder{$tag}{$sysmap{$name}} = $bootorder
-                if (exists $sysmap{$name});
+            } else {
+                $provideslist{$script} = $order;
+            }
+        }
+        $scriptorder{'S'}{'$all'} = $allorder;
+    }
+    for my $scriptpath (@scripts) {
+        my $script = $scriptpath;
+        $script =~ s%^.*/([^/]+)$%$1%;
+        $bootorder++;
+        my ($tag, $order, $name) = $script =~ m/^(.)(\d{2})(.+)$/;
+
+        $scriptorder{$tag}{$name} = $bootorder;
+        $scriptorder{$tag}{$sysmap{$name}} = $bootorder
+            if (exists $sysmap{$name});
 
 #           print "$script\n";
 #           print "T: $tag O: $order N: $name\n";
-            my $lsbinforef = load_lsb_tags("$rcbase/$rcdir/$script",
-                                           $useoverrides);
-
-            unless (defined $lsbinforef) {
-                print STDERR "LSB header missing in $rcbase/$rcdir/$script\n";
-                next;
-            }
-            my %lsbinfo = %{$lsbinforef};
-
-            for my $provide (split(/\s+/, $lsbinfo{'provides'})) {
-                $scriptorder{$tag}{$provide} = $bootorder;
-                $scriptorder{$tag}{$sysmap{$provide}} = $bootorder
-                    if (exists $sysmap{$provide});
-            }
-
-            if ('S' eq $tag) {
-                if ($lsbinfo{'required-start'}) {
-                    my @depends = split(/\s+/, $lsbinfo{'required-start'});
-                    for my $dep (@depends) {
-                        unless (exists $scriptorder{$tag}{$dep}
-                                and $scriptorder{$tag}{$dep} < $bootorder) {
-                            my $deporder;
-                            if (exists $scriptorder{$tag}{$dep}) {
-                                $deporder = $scriptorder{$tag}{$dep}
-                            } else {
-                                $deporder = "?";
-                            }
-                            print "Incorrect order " .
-                                "$dep\@$deporder > $name\@$order\n";
-                        }
-                    }
-                }
-            }
-            if ('K' eq $tag) {
-            }
+        my $lsbinforef = load_lsb_tags($scriptpath,
+                                       $useoverrides);
+
+        unless (defined $lsbinforef) {
+            print STDERR "LSB header missing in $scriptpath\n";
+            next;
+        }
+        my %lsbinfo = %{$lsbinforef};
+
+        for my $provide (split(/\s+/, $lsbinfo{'provides'})) {
+            $scriptorder{$tag}{$provide} = $bootorder;
+            $scriptorder{$tag}{$sysmap{$provide}} = $bootorder
+                if (exists $sysmap{$provide});
+        }
+
+        if ('S' eq $tag) {
+            check_deps($lsbinforef, $tag, $order, $bootorder, 'required-start', 1);
+            check_deps($lsbinforef, $tag, $order, $bootorder, 'should-start', 0);
+        }
+        if ('K' eq $tag) {
+            check_deps($lsbinforef, $tag, $order, $bootorder, 'required-stop', 1);
+            check_deps($lsbinforef, $tag, $order, $bootorder, 'should-stop', 0);
         }
     }
 }

Modified: trunk/src/insserv/debian/update-bootsystem-insserv
URL: http://svn.debian.org/wsvn/initscripts-ng/trunk/src/insserv/debian/update-bootsystem-insserv?rev=391&op=diff
==============================================================================
--- trunk/src/insserv/debian/update-bootsystem-insserv (original)
+++ trunk/src/insserv/debian/update-bootsystem-insserv Tue Jan  1 11:08:30 2008
@@ -30,7 +30,7 @@
 # Recreate sysv boot sequence by calling the postinst for all packages
 # with init.d scripts, to get them to call update-rc.d again.
 regenerate_sysv_sequence() {
-    packages="`dpkg -S /etc/init.d/* 2>/dev/null | cut -d: -f1|sort -u`"
+    packages="$(dpkg -S $(find /etc/init.d -type f -perm /+x) 2>/dev/null | cut -d: -f1 | sort -u)"
 
     for p in $packages ; do
         # Make sure it is installed
@@ -48,9 +48,11 @@
     # As the sysv-rc update-rc.d script do not check dependencies, it
     # is enough to run through these scripts once.
     for p in $brokenpackages ; do
-	echo "Running package $p postinst"
-	DEBCONF_FRONTEND=noninteractive	\
-	    /var/lib/dpkg/info/$p.postinst configure < /dev/null || true
+	if [ -x /var/lib/dpkg/info/$p.postinst ] ; then
+	    echo "Running package $p postinst"
+	    DEBCONF_FRONTEND=noninteractive	\
+		/var/lib/dpkg/info/$p.postinst configure < /dev/null || true
+	else
     done
 }
 




More information about the Initscripts-ng-commits mailing list