[Pkg-sysvinit-commits] r842 - in sysvinit/trunk/debian: .
sysv-rc/man8 sysv-rc/sbin
Petter Reinholdtsen
pere at costa.debian.org
Wed Sep 6 07:20:18 UTC 2006
Author: pere
Date: 2006-09-06 07:20:18 +0000 (Wed, 06 Sep 2006)
New Revision: 842
Modified:
sysvinit/trunk/debian/changelog
sysvinit/trunk/debian/sysv-rc/man8/update-rc.d.8
sysvinit/trunk/debian/sysv-rc/sbin/update-rc.d
Log:
* Add support for parsing LSB headers in update-rc.d, and use the
runlevel information in the default-start and default-stop headers
if they are present. Document this in update-rc.d(8). This can
be used instead of the 'multiuser' extention in Ubuntu, by setting
the 'default-stop' value to '1' in the init.d script.
Modified: sysvinit/trunk/debian/changelog
===================================================================
--- sysvinit/trunk/debian/changelog 2006-09-06 06:57:25 UTC (rev 841)
+++ sysvinit/trunk/debian/changelog 2006-09-06 07:20:18 UTC (rev 842)
@@ -42,6 +42,11 @@
* Add empty functions pre_mountall and post_mountall to reduce the
difference between the Ubuntu version
* Modify update-rc.d to run properly with perl error checking enabled.
+ * Add support for parsing LSB headers in update-rc.d, and use the
+ runlevel information in the default-start and default-stop headers
+ if they are present. Document this in update-rc.d(8). This can
+ be used instead of the 'multiuser' extention in Ubuntu, by setting
+ the 'default-stop' value to '1' in the init.d script.
-- Petter Reinholdtsen <pere at debian.org> Wed, 26 Jul 2006 11:37:23 +0200
Modified: sysvinit/trunk/debian/sysv-rc/man8/update-rc.d.8
===================================================================
--- sysvinit/trunk/debian/sysv-rc/man8/update-rc.d.8 2006-09-06 06:57:25 UTC (rev 841)
+++ sysvinit/trunk/debian/sysv-rc/man8/update-rc.d.8 2006-09-06 07:20:18 UTC (rev 842)
@@ -108,7 +108,13 @@
will make links to start the service in runlevels
.B 2345
and to stop the service in runlevels
-.BR 016 .
+.BR 016
+unless an LSB-style header is present in the init.d script. If such
+header exist, the levels listed in the
+.B Default-Start
+and
+.B Default-Stop
+fields in that header are used instead.
By default all the links will have sequence number 20, but
this can be overridden by supplying one
.I NN
Modified: sysvinit/trunk/debian/sysv-rc/sbin/update-rc.d
===================================================================
--- sysvinit/trunk/debian/sysv-rc/sbin/update-rc.d 2006-09-06 06:57:25 UTC (rev 841)
+++ sysvinit/trunk/debian/sysv-rc/sbin/update-rc.d 2006-09-06 07:20:18 UTC (rev 842)
@@ -118,6 +118,26 @@
$found;
}
+sub parse_lsb_header {
+ my $initdscript = shift;
+ my %lsbinfo;
+ 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);
+ return %lsbinfo;
+}
+
+
# Process the arguments after the "defaults" keyword.
sub defaults {
@@ -132,10 +152,27 @@
$start = sprintf("%02d", $start);
$stop = sprintf("%02d", $stop);
- $stoplinks[0] = $stoplinks[1] = $stoplinks[6] = "K$stop";
- $startlinks[2] = $startlinks[3] =
- $startlinks[4] = $startlinks[5] = "S$start";
+ my %lsbinfo = parse_lsb_header("$initd/$bn");
+ if (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";
+ }
+
1;
}
More information about the Pkg-sysvinit-commits
mailing list