[Pkg-sysvinit-commits] r1258 - in sysvinit/trunk/debian: . sysv-rc/sbin

pere at alioth.debian.org pere at alioth.debian.org
Thu Mar 20 08:34:23 UTC 2008


Author: pere
Date: 2008-03-20 08:34:23 +0000 (Thu, 20 Mar 2008)
New Revision: 1258

Modified:
   sysvinit/trunk/debian/changelog
   sysvinit/trunk/debian/sysv-rc/sbin/update-rc.d
Log:
  * Change update-rc.d to warn about scripts missing LSB style
    dependency information.

Modified: sysvinit/trunk/debian/changelog
===================================================================
--- sysvinit/trunk/debian/changelog	2008-03-14 17:22:14 UTC (rev 1257)
+++ sysvinit/trunk/debian/changelog	2008-03-20 08:34:23 UTC (rev 1258)
@@ -7,6 +7,8 @@
     enabled and if startpar fail to run.
   * Adjust init.d script dependencies for bootmisc.sh, as it can run
     before $remote_fs and need to run after both udev and hostname.
+  * Change update-rc.d to warn about scripts missing LSB style
+    dependency information.
 
  -- Petter Reinholdtsen <pere at localhost>  Sun, 02 Mar 2008 11:27:34 +0100
 

Modified: sysvinit/trunk/debian/sysv-rc/sbin/update-rc.d
===================================================================
--- sysvinit/trunk/debian/sysv-rc/sbin/update-rc.d	2008-03-14 17:22:14 UTC (rev 1257)
+++ sysvinit/trunk/debian/sysv-rc/sbin/update-rc.d	2008-03-20 08:34:23 UTC (rev 1258)
@@ -134,20 +134,28 @@
 sub parse_lsb_header {
     my $initdscript = shift;
     my %lsbinfo;
-    if (-e $lsbparseflag) {
-	my $lsbfound = 0;
-	my $lsbheaders = "Provides|Default-Start|Default-Stop";
-	open(INIT, "<$initdscript") || die "error: unable to read $initdscript";
-	while (<INIT>) {
-	    chomp;
-	    $lsbfound = 1 if (m/^\#\#\# BEGIN INIT INFO$/);
-	    last if (m/\#\#\# END INIT INFO$/);
-	    if (m/^\# (Default-Start|Default-stop):\s*(\S?.*)$/i) {
-		$lsbinfo{lc($1)} = $2;
-	    }
-	}
-	close(INIT);
+    my $lsbheaders = "Provides|Required-Start|Required-Stop|Default-Start|Default-Stop";
+    open(INIT, "<$initdscript") || die "error: unable to read $initdscript";
+    while (<INIT>) {
+        chomp;
+        $lsbinfo{'found'} = 1 if (m/^\#\#\# BEGIN INIT INFO$/);
+        last if (m/\#\#\# END INIT INFO$/);
+        if (m/^\# ($lsbheaders):\s*(\S?.*)$/i) {
+    	$lsbinfo{lc($1)} = $2;
+        }
     }
+    close(INIT);
+
+    # Check that all the required headers are present
+    if (!$lsbinfo{found}) {
+	printf STDERR "update-rc.d: $initdscript missing LSB header\n";
+    } else {
+        for my $key (split(/\|/, lc($lsbheaders))) {
+            if (!exists $lsbinfo{$key}) {
+                print STDERR "update-rc.d: $initdscript missing LSB header entry '$key'\n";
+            }
+        }
+    }
     return %lsbinfo;
 }
 
@@ -167,8 +175,7 @@
     $stop  = sprintf("%02d", $stop);
 
     my %lsbinfo = parse_lsb_header("$initd/$bn");
-
-    if (exists $lsbinfo{'default-stop'}) {
+    if (-e $lsbparseflag && exists $lsbinfo{'default-stop'}) {
 	for my $level (split(/\s+/, $lsbinfo{'default-stop'})) {
 	    $level = 99 if ($level eq 'S');
 	    $stoplinks[$level] = "K$stop";




More information about the Pkg-sysvinit-commits mailing list