[Initscripts-ng-commits] r218 - in /trunk/www/soc2006-bootsystem: code/correct-init-order deliverable3/debianboot_d3.kilepr

dvictoria-guest at users.alioth.debian.org dvictoria-guest at users.alioth.debian.org
Sun Sep 24 08:16:41 UTC 2006


Author: dvictoria-guest
Date: Sun Sep 24 08:16:40 2006
New Revision: 218

URL: http://svn.debian.org/wsvn/initscripts-ng/?sc=1&rev=218
Log:
modifications to script to correct boot order

Modified:
    trunk/www/soc2006-bootsystem/code/correct-init-order
    trunk/www/soc2006-bootsystem/deliverable3/debianboot_d3.kilepr

Modified: trunk/www/soc2006-bootsystem/code/correct-init-order
URL: http://svn.debian.org/wsvn/initscripts-ng/trunk/www/soc2006-bootsystem/code/correct-init-order?rev=218&op=diff
==============================================================================
--- trunk/www/soc2006-bootsystem/code/correct-init-order (original)
+++ trunk/www/soc2006-bootsystem/code/correct-init-order Sun Sep 24 08:16:40 2006
@@ -25,8 +25,8 @@
 use File::Basename;
 
 #my $initdir = "/etc/";
-my $initdir = "/home/carlos/Academia/debian";
-my $overridepath = "/home/carlos/Academia/debian/insserv/overrides";
+my $initdir = "/home/greg/Academia/debian";
+my $overridepath = "/home/greg/Academia/debian/insserv/overrides";
 
 # my $debug = 0;
 # my $web = 0;
@@ -45,7 +45,10 @@
      'rc2.d' => '2',
      );
 
-readinfo();
+readinfo();  # read actual and LSB run-time dependencies and save in hash called scriptinfo.
+
+checkorder();
+
 
 
 sub readinfo {
@@ -54,44 +57,93 @@
 	my $scriptname;
 	for my $rcdir (@dirs) {
 		chdir "$initdir/$rcdir";
-		print "$initdir/$rcdir";
-			for my $script (<*hwclock.sh>) {
+			for my $script (<S*>) {
 			$bootorder++;	
 			print STDOUT "\n-------------------------------------------\nLoading $initdir/$rcdir/$script\n";
 
 			if ($script =~ m/S(\d{2})(\S*)/) {
 				$scriptname = $2;
 				$scriptinfo{$scriptname}{'num_ist'}=$1;
-				print "name = $2\n";
-				print "number = $1\n";
 				}
-			print "real order = $bootorder\n";
 
 			$scriptinfo{$scriptname}{'runlevel_ist'}=$rc{$rcdir};
 			$scriptinfo{$scriptname}{'order_ist'}=$bootorder;
 			
 			my $lsbinforef = load_lsb_tags("$initdir/$rcdir/$script", 0);
 			unless (defined $lsbinforef) {
-			print STDERR "LSB header missing in $initdir/$rcdir/$script\n";
-			next;
+				print STDERR "LSB header missing in $initdir/$rcdir/$script\n";
+				next;
 			    }
 			my %lsbinfo = %{$lsbinforef};
 
-			print "required-start = $lsbinfo{'required-start'}\n";
-			print "should-start = $lsbinfo{'should-start'}\n";
-			print "default-start = $lsbinfo{'default-start'}\n";
 			$scriptinfo{$scriptname}{'required'}=$lsbinfo{'required-start'};
 			$scriptinfo{$scriptname}{'should'}=$lsbinfo{'should-start'};
 			$scriptinfo{$scriptname}{'default_rl'}=$lsbinfo{'default-start'};
-			
-
-
+			print "name = $scriptname\n";
+			print "runlevel = $scriptinfo{$scriptname}{'runlevel_ist'}\n";
+			print "number = $scriptinfo{$scriptname}{'num_ist'}\n";
+			print "order = $scriptinfo{$scriptname}{'order_ist'}\n";
+			print "required scripts = $scriptinfo{$scriptname}{'required'}\n";
+			print "should start scripts = $scriptinfo{$scriptname}{'should'}\n";
+			print "default runlevel = $scriptinfo{$scriptname}{'default_rl'}\n";
 
 			
 				}
 			}
 		}
 		
+sub checkorder {
+	my $bootorder = 0;
+	my @dirs = ('rcS.d','rc2.d');
+	my $scriptname;
+	my $found_rl;
+	for my $rcdir (@dirs) {
+		chdir "$initdir/$rcdir";
+		for my $script (<S*>) {
+		$bootorder++;	
+		print STDOUT "\n-------------------------------------------\nChecking order of $initdir/$rcdir/$script\n";
+			
+		$scriptname = $2 if ($script =~ m/S(\d{2})(\S*)/);
+		
+		if ($scriptinfo{$scriptname}{'required'}) {
+	    		my @depends = split(/\s+/, $scriptinfo{$scriptname}{'required'});
+	    		for my $dep (@depends) {
+				unless (exists $scriptinfo{$dep}{'order_ist'} and $scriptinfo{$dep}{'order_ist'} < $scriptinfo{$scriptname}{'order_ist'}) {
+				print "Incorrect order: $dep\@ $scriptinfo{$dep}{'order_ist'} > $scriptname\@$scriptinfo{$scriptname}{'order_ist'}\n";
+					}
+		    		}
+			}
+
+
+		if ($scriptinfo{$scriptname}{'should'}) {
+	    		my @shoulds = split(/\s+/, $scriptinfo{$scriptname}{'should'});
+	    		for my $sho (@shoulds) {
+				if (exists $scriptinfo{$sho}{'order_ist'}){
+					unless ($scriptinfo{$sho}{'order_ist'} < $scriptinfo{$scriptname}{'order_ist'}) {
+				print "Incorrect SHOULD order: $sho\@ $scriptinfo{$sho}{'order_ist'} > $scriptname\@$scriptinfo{$scriptname}{'order_ist'}\n";
+						}	
+					}
+		    		}
+			}
+
+		$found_rl=0;
+		if ($scriptinfo{$scriptname}{'default_rl'}) {
+	    		my @runlevels = split(/\s+/, $scriptinfo{$scriptname}{'default_rl'});
+	    		for my $run (@runlevels) {
+				if (exists $scriptinfo{$scriptname}{'default_rl'} and $scriptinfo{$scriptname}{'runlevel_ist'} == $scriptinfo{$scriptname}{'$run'}) {
+				$found_rl=1;
+					}
+		    		}
+				if ($found_rl == 0) {
+					print "Wrong or undefined runlevel\n";
+					}
+			}
+
+
+		}
+	}
+}
+
 
 sub load_lsb_tags {
     my ($initfile, $useoverrides) = @_;

Modified: trunk/www/soc2006-bootsystem/deliverable3/debianboot_d3.kilepr
URL: http://svn.debian.org/wsvn/initscripts-ng/trunk/www/soc2006-bootsystem/deliverable3/debianboot_d3.kilepr?rev=218&op=diff
==============================================================================
--- trunk/www/soc2006-bootsystem/deliverable3/debianboot_d3.kilepr (original)
+++ trunk/www/soc2006-bootsystem/deliverable3/debianboot_d3.kilepr Sun Sep 24 08:16:40 2006
@@ -25,8 +25,8 @@
 
 [item:debianboot_d3.tex]
 archive=true
-column=0
+column=162
 encoding=ISO 8859-1
 highlight=LaTeX
-line=343
+line=341
 open=true




More information about the Initscripts-ng-commits mailing list