[Initscripts-ng-commits] r346 - in /trunk/src/insserv/debian: changelog check-initd-order
pere at users.alioth.debian.org
pere at users.alioth.debian.org
Sun Dec 30 13:02:49 UTC 2007
Author: pere
Date: Sun Dec 30 13:02:49 2007
New Revision: 346
URL: http://svn.debian.org/wsvn/initscripts-ng/?sc=1&rev=346
Log:
* Extend check-initd-order to handle the virtual dependecy $all.
Modified:
trunk/src/insserv/debian/changelog
trunk/src/insserv/debian/check-initd-order
Modified: trunk/src/insserv/debian/changelog
URL: http://svn.debian.org/wsvn/initscripts-ng/trunk/src/insserv/debian/changelog?rev=346&op=diff
==============================================================================
--- trunk/src/insserv/debian/changelog (original)
+++ trunk/src/insserv/debian/changelog Sun Dec 30 13:02:49 2007
@@ -3,6 +3,7 @@
* UNRELEASED
* Try to make disabling code more robust by using trick used by
sysvinit once to recover the boot sequence settings.
+ * Extend check-initd-order to handle the virtual dependecy $all.
-- Petter Reinholdtsen <pere at debian.org> Sun, 30 Dec 2007 12:39:33 +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=346&op=diff
==============================================================================
--- trunk/src/insserv/debian/check-initd-order (original)
+++ trunk/src/insserv/debian/check-initd-order Sun Dec 30 13:02:49 2007
@@ -8,7 +8,7 @@
#
# To generate a graph, run it like this
#
-# check-initd-order -g > initorder.dotty && dotty initorder.dotty
+# check-initd-order -g > initorder.dotty && dotty initorder.dotty
use strict;
use warnings;
@@ -57,10 +57,10 @@
my %opts;
while($#ARGV >= 0 && ($_ = $ARGV[0]) =~ /^-/) {
- shift @ARGV;
- if (/^-([dgko])$/) { $opts{$1}++; next }
- if (/^-h|--help$/) { &usage; }
- &usage("unknown option");
+ shift @ARGV;
+ if (/^-([dgko])$/) { $opts{$1}++; next }
+ if (/^-h|--help$/) { &usage; }
+ &usage("unknown option");
}
$debug = $opts{'d'};
@@ -93,34 +93,34 @@
my %lsbinfo = @_;
unless ($lsbinfo{'provides'}) {
- print STDERR "error: File ". $lsbinfo{'file'} . " is missing the provides header\n";
- $lsbinfo{'provides'} = $lsbinfo{'file'};
+ print STDERR "error: File ". $lsbinfo{'file'} . " is missing the provides header\n";
+ $lsbinfo{'provides'} = $lsbinfo{'file'};
}
my $key = $opts{'k'} ? 'stop' : 'start';
my @provides = split(/\s+/, $lsbinfo{'provides'});
for my $name (@provides) {
- if (exists $sysmap{$name}) {
- graph_addnode('provides' => $sysmap{$name},
- "required-$key" => $name);
- }
+ if (exists $sysmap{$name}) {
+ graph_addnode('provides' => $sysmap{$name},
+ "required-$key" => $name);
+ }
}
if (1 < @provides) {
- print STDERR "warning: Unable to properly handle multiple provides: @provides\n";
+ print STDERR "warning: Unable to properly handle multiple provides: @provides\n";
}
if (exists $lsbinfo{"required-$key"} && $lsbinfo{"required-$key"}) {
- my @depends = split(/\s+/, $lsbinfo{"required-$key"});
- for my $pkg (@depends) {
- print "\"$pkg\" -> \"$provides[0]\"[color=blue];\n";
- }
+ my @depends = split(/\s+/, $lsbinfo{"required-$key"});
+ for my $pkg (@depends) {
+ print "\"$pkg\" -> \"$provides[0]\"[color=blue];\n";
+ }
}
if (exists $lsbinfo{"should-$key"} && $lsbinfo{"should-$key"}) {
- my @depends = split(/\s+/, $lsbinfo{"should-$key"});
- for my $pkg (@depends) {
- print "\"$pkg\" -> \"$provides[0]\"[color=springgreen] ;\n";
- }
+ my @depends = split(/\s+/, $lsbinfo{"should-$key"});
+ for my $pkg (@depends) {
+ print "\"$pkg\" -> \"$provides[0]\"[color=springgreen] ;\n";
+ }
}
print "\"$provides[0]\" [shape=box];\n";
}
@@ -133,19 +133,19 @@
EOF
my @dirs = $opts{'k'} ? $rcmap{6} : ($rcmap{S}, $rcmap{2});
for my $rcdir (@dirs) {
- chdir "$rcbase/$rcdir/.";
- my @scripts = $opts{'k'} ? <K*> : <S*>;
- for my $script (@scripts) {
- my $lsbinforef = load_lsb_tags("$rcbase/$rcdir/$script",
- $useoverrides);
-
- unless (defined $lsbinforef) {
- print STDERR "warning: LSB header missing in $rcbase/$rcdir/$script\n";
- $lsbinforef = {'provides' => $script};
- }
- my %lsbinfo = %{$lsbinforef};
- graph_addnode %lsbinfo;
- }
+ chdir "$rcbase/$rcdir/.";
+ my @scripts = $opts{'k'} ? <K*> : <S*>;
+ for my $script (@scripts) {
+ my $lsbinforef = load_lsb_tags("$rcbase/$rcdir/$script",
+ $useoverrides);
+
+ unless (defined $lsbinforef) {
+ print STDERR "warning: LSB header missing in $rcbase/$rcdir/$script\n";
+ $lsbinforef = {'provides' => $script};
+ }
+ my %lsbinfo = %{$lsbinforef};
+ graph_addnode %lsbinfo;
+ }
}
print <<EOF;
}
@@ -156,54 +156,75 @@
my $bootorder = 0;
my @dirs = $opts{'k'} ? $rcmap{6} : ($rcmap{S}, $rcmap{2});
for my $rcdir (@dirs) {
- chdir "$rcbase/$rcdir/.";
- my @scripts = $opts{'k'} ? <K*> : <S*>;
- 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});
-
-# 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) {
- }
- }
+ chdir "$rcbase/$rcdir/.";
+ my @scripts = $opts{'k'} ? <K*> : <S*>;
+
+ if ($opts{'k'}) {
+ $scriptorder{'K'}{'$all'} = 0;
+ } 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;
+ }
+ }
+ $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});
+
+# 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) {
+ }
+ }
}
}
@@ -212,22 +233,22 @@
my $lsbinforef = load_lsb_tags_from_file($initfile);
if ($useoverrides) {
- # Try override file
- $initfile = readlink($initfile) if (-l $initfile);
- my $basename = basename($initfile);
-
- # Only read shipped override file when initscript does not
- # contain LSB tags.
- if (! defined($lsbinforef) && -f "$overridepath/$basename") {
- print STDERR "Override $overridepath/$basename\n" if $debug;
- $lsbinforef = load_lsb_tags_from_file("$overridepath/$basename");
- }
-
- # Always read the host override in $hostoverridepath.
- if (-f "$hostoverridepath/$basename") {
- print STDERR "Override $hostoverridepath/$basename\n" if $debug;
- $lsbinforef = load_lsb_tags_from_file("$hostoverridepath/$basename");
- }
+ # Try override file
+ $initfile = readlink($initfile) if (-l $initfile);
+ my $basename = basename($initfile);
+
+ # Only read shipped override file when initscript does not
+ # contain LSB tags.
+ if (! defined($lsbinforef) && -f "$overridepath/$basename") {
+ print STDERR "Override $overridepath/$basename\n" if $debug;
+ $lsbinforef = load_lsb_tags_from_file("$overridepath/$basename");
+ }
+
+ # Always read the host override in $hostoverridepath.
+ if (-f "$hostoverridepath/$basename") {
+ print STDERR "Override $hostoverridepath/$basename\n" if $debug;
+ $lsbinforef = load_lsb_tags_from_file("$hostoverridepath/$basename");
+ }
}
return $lsbinforef;
@@ -248,21 +269,21 @@
### END INIT INFO
unless (open(FILE, "<$file")) {
warn "error: Unable to read $file";
- return;
+ return;
}
my $found = 0;
my ($provides, $requiredstart, $requiredstop, $shouldstart, $shouldstop);
while (<FILE>) {
- chomp;
- $found = 1 if (m/\#\#\# BEGIN INIT INFO/);
- next unless $found;
- last if (m/\#\#\# END INIT INFO/);
-
- $provides = $1 if (m/^\# provides:\s+(\S*.*\S+)\s*$/i);
- $requiredstart = $1 if (m/^\# required-start:\s+(\S*.*\S+)\s*$/i);
- $requiredstop = $1 if (m/^\# required-stop:\s+(\S*.*\S+)\s*$/i);
- $shouldstart = $1 if (m/^\# should-start:\s+(\S*.*\S+)\s*$/i);
- $shouldstop = $1 if (m/^\# should-stop:\s+(\S*.*\S+)\s*$/i);
+ chomp;
+ $found = 1 if (m/\#\#\# BEGIN INIT INFO/);
+ next unless $found;
+ last if (m/\#\#\# END INIT INFO/);
+
+ $provides = $1 if (m/^\# provides:\s+(\S*.*\S+)\s*$/i);
+ $requiredstart = $1 if (m/^\# required-start:\s+(\S*.*\S+)\s*$/i);
+ $requiredstop = $1 if (m/^\# required-stop:\s+(\S*.*\S+)\s*$/i);
+ $shouldstart = $1 if (m/^\# should-start:\s+(\S*.*\S+)\s*$/i);
+ $shouldstop = $1 if (m/^\# should-stop:\s+(\S*.*\S+)\s*$/i);
}
close(FILE);
@@ -270,11 +291,11 @@
# print "Provides: $provides\n" if $provides;
return {
- 'provides' => $provides,
- 'required-start' => $requiredstart,
- 'required-stop' => $requiredstop,
- 'should-start' => $shouldstart,
- 'should-stop' => $shouldstop,
- 'file' => $file,
- };
-}
+ 'provides' => $provides,
+ 'required-start' => $requiredstart,
+ 'required-stop' => $requiredstop,
+ 'should-start' => $shouldstart,
+ 'should-stop' => $shouldstop,
+ 'file' => $file,
+ };
+}
More information about the Initscripts-ng-commits
mailing list