49 lines
1.1 KiB
Perl
49 lines
1.1 KiB
Perl
#!/usr/bin/perl
|
|
|
|
# step maker for bootup.pl
|
|
|
|
use Storable;
|
|
|
|
%steps = ();
|
|
|
|
open(steps,"<steps");
|
|
@lines = <steps>;
|
|
close steps;
|
|
|
|
# First item must be total number of steps
|
|
|
|
# each step consists of actions, can be multiple
|
|
|
|
foreach(@lines){
|
|
|
|
if($_ =~ /(step)/i){
|
|
#print "New step number $sc\n";
|
|
$sc++;
|
|
$substep = 1;
|
|
next;
|
|
}else{
|
|
@lp = split(/ /,$_);
|
|
#print " Step num = $sc\n";
|
|
for (my $i=1; $i <= scalar(@lp); $i++) {
|
|
$cmd .= "@lp[$i] ";
|
|
}
|
|
#print "CMD = $cmd";
|
|
$steps{$sc}{$substep}{@lp[0]} = $cmd;
|
|
#print "LP = @lp\n";
|
|
undef(@lp);
|
|
undef($cmd);
|
|
$substep++;
|
|
}
|
|
}
|
|
|
|
for $family ( keys %steps ) {
|
|
#print "Step # $family: ";
|
|
for $role ( keys %{ $steps{$family} } ) {
|
|
for $exeord ( keys %{ $steps{$family}{$role}}){
|
|
# print "sub hashex $exeord $role=$steps{$family}{$role}{$exeord} ";
|
|
}
|
|
#print "sub hash $role=$steps{$family}{$role} ";
|
|
}
|
|
# print "\n";
|
|
}
|
|
store \%steps, 'stpcomp';
|