diff options
author | Arthur Xiong <arthur@vyatta.com> | 2010-05-07 05:40:10 +0000 |
---|---|---|
committer | Arthur Xiong <arthur@vyatta.com> | 2010-05-07 05:40:10 +0000 |
commit | 00c9408cc61cece9147c98f3f715e435b4a462b5 (patch) | |
tree | 900a1d204d5ac35c13ae3bc30755ff36ad917bb5 | |
parent | 33fa62cd3022f663d8513dae7eab93e23a89c176 (diff) | |
download | vyatta-cfg-00c9408cc61cece9147c98f3f715e435b4a462b5.tar.gz vyatta-cfg-00c9408cc61cece9147c98f3f715e435b4a462b5.zip |
1) skip comment and empty lines in priority file;
2) remove priority from node.def when priority value is 0 in priority file;
3) copy over comment and empty lines in the beginning of node.def
-rw-r--r-- | scripts/update-priority.pl | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/scripts/update-priority.pl b/scripts/update-priority.pl index 84b4933..feb1e7f 100644 --- a/scripts/update-priority.pl +++ b/scripts/update-priority.pl @@ -38,7 +38,7 @@ my $prefix = $ARGV[1]; open my $pf, '<', $priority_file or die "$priority_file can't be opened"; while (<$pf>) { chomp; - next if /^#.*/; + next if /^#.*/ or /^$/; die "Syntax Error \"$_\"" unless /^(\d+)\s+(\S+)(|\s+|\s+#.*)$/; $priority = $1; $path = $2; @@ -55,11 +55,12 @@ while (<$pf>) { open my $nf, '<', $node_def or die "$node_def can't be opened"; open my $nfn, '>', "$node_def.new" or die "$node_def.new can't be opened"; while (<$nf>) { - print $nfn $_ if /^(tag|multi):/; - print $nfn $priority_line; - print $nfn $_ unless /^priority:\s(\d+)/ or /^(tag|multi):/; - last if $. == 1; + last unless /^#.*/ or /^$/; + print $nfn $_; } + print $nfn $_ if /^(tag|multi):/; + print $nfn $priority_line if $priority != 0; + print $nfn $_ unless /^priority:\s(\d+)/ or /^(tag|multi):/; while (<$nf>) { print $nfn $_ unless /^priority:\s(\d+)/; } |