[Pkg-sysvinit-devel] [PATCH 1/4] update-rc.d: Remove /etc/update-rc.d-lsbparse flag and warn about missing LSB init info

Kel Modderman kel at otaku42.de
Sun Jul 13 14:48:11 UTC 2008


insserv exists now to parse Default-{Start,Stop} from LSB init info for a
script, therefore this "legacy" support for those fields should be removed.

Warn admin if an initscript lacks required LSB init info, so that it is evident
on non insserv'd systems that they are required. Add a link to Debian wiki page
containing LSB initscript information for users and package maintainers.
---
--- a/debian/sysv-rc/sbin/update-rc.d
+++ b/debian/sysv-rc/sbin/update-rc.d
@@ -10,11 +10,6 @@
 my $etcd  = "/etc/rc";
 my $notreally = 0;
 
-# Only parse the LSB headers when this flag exist.  It is to be used
-# while we test this new feature, and should be removed when we are
-# confident that LSB headers are correct. [pere 2006-09-06]
-my $lsbparseflag = "/etc/update-rc.d-lsbparse";
-
 # Print usage message and die.
 
 sub usage {
@@ -55,6 +50,7 @@
 	print STDERR "update-rc.d: $initd/$bn: file does not exist\n";
 	exit (1);
     }
+    &parse_lsb_header("$initd/$bn");
 } elsif (-f "$initd/$bn") {
     if (!$force) {
 	printf STDERR "update-rc.d: $initd/$bn exists during rc.d purge (use -f to force)\n";
@@ -148,15 +144,15 @@
 
     # Check that all the required headers are present
     if (!$lsbinfo{found}) {
-	printf STDERR "update-rc.d: warning: $initdscript missing LSB style header\n";
+	printf STDERR "update-rc.d: warning: $initdscript missing LSB information\n";
+	printf STDERR "update-rc.d: see <http://wiki.debian.org/LSBInitScripts>\n";
     } else {
         for my $key (split(/\|/, lc($lsbheaders))) {
             if (!exists $lsbinfo{$key}) {
-                print STDERR "update-rc.d: warning: $initdscript missing LSB style header entry '$key'\n";
+                print STDERR "update-rc.d: warning: $initdscript missing LSB keyword '$key'\n";
             }
         }
     }
-    return %lsbinfo;
 }
 
 
@@ -174,25 +170,8 @@
     $start = sprintf("%02d", $start);
     $stop  = sprintf("%02d", $stop);
 
-    my %lsbinfo = parse_lsb_header("$initd/$bn");
-    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";
-	}
-    } else {
-	$stoplinks[0] = $stoplinks[1] = $stoplinks[6] = "K$stop";
-    }
-
-    if (exists $lsbinfo{'default-start'}) {
-	for my $level (split(/\s+/, $lsbinfo{'default-start'})) {
-	    $level = 99 if ($level eq 'S');
-	    $startlinks[$level] = "S$start";
-	}
-    } else {
-	$startlinks[2] = $startlinks[3] =
-	    $startlinks[4] = $startlinks[5] = "S$start";
-    }
+    $stoplinks[$_]  = "K$stop"  for (0, 1, 6);
+    $startlinks[$_] = "S$start" for (2, 3, 4, 5);
 
     1;
 }
--- a/debian/sysv-rc/man8/update-rc.d.8
+++ b/debian/sysv-rc/man8/update-rc.d.8
@@ -108,14 +108,7 @@
 will make links to start the service in runlevels
 .B 2345
 and to stop the service in runlevels
-.BR 016 
-unless an LSB-style header is present in the init.d script and the
-.B /etc/update-rc.d-lsbparse
-file exist.  If such header exist, the levels listed in the
-.B Default-Start
-and
-.B Default-Stop
-fields in that header are used instead.
+.BR 016 .
 By default all the links will have sequence number 20, but
 this should be overridden if there are dependencies. For example if
 daemon B depends on A, then A must be started before B and B must be
---



More information about the Pkg-sysvinit-devel mailing list