summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorArthur Xiong <arthur@vyatta.com>2010-05-07 05:40:10 +0000
committerArthur Xiong <arthur@vyatta.com>2010-05-07 05:40:10 +0000
commit00c9408cc61cece9147c98f3f715e435b4a462b5 (patch)
tree900a1d204d5ac35c13ae3bc30755ff36ad917bb5 /scripts
parent33fa62cd3022f663d8513dae7eab93e23a89c176 (diff)
downloadvyatta-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
Diffstat (limited to 'scripts')
-rw-r--r--scripts/update-priority.pl11
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+)/;
}