summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-11-12 09:49:04 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-11-12 09:49:04 -0800
commitddc25a06ac3a1fc76491a89c71f20a499b5d8187 (patch)
tree0c126ae4d3ded51d4b362649f1b73b7df1b08fc4 /scripts
parent5956c4053c0de30a6d9028773b3540dc37534923 (diff)
parent472c42136c47446b3980335aa819df6bcff5caa3 (diff)
downloadvyatta-cfg-ddc25a06ac3a1fc76491a89c71f20a499b5d8187.tar.gz
vyatta-cfg-ddc25a06ac3a1fc76491a89c71f20a499b5d8187.zip
Merge branch 'kenwood' of suva.vyatta.com:/git/vyatta-cfg into kenwood
Diffstat (limited to 'scripts')
-rw-r--r--scripts/priority.pl31
1 files changed, 21 insertions, 10 deletions
diff --git a/scripts/priority.pl b/scripts/priority.pl
index 59239bf..39f6220 100644
--- a/scripts/priority.pl
+++ b/scripts/priority.pl
@@ -2,16 +2,29 @@
my %pri;
- # first check if this file exists, and if so ensure this is a config file.
+# Look at all node.def files in the configuration template tree
my @files = `find /opt/vyatta/share/vyatta-cfg -name 'node.def'`;
foreach my $f (@files) {
my $result = `grep 'priority:' $f`;
- if (defined $result && length($result) != 0) {
- my @r = split " ", $result;
- if (defined $r[1]) {
- #stuff in hash here
- push @{$pri{$r[1]}},$f;
- }
+ if (defined $result && length($result) != 0) {
+ my @r = split " ", $result;
+ if (defined $r[1]) {
+ # Strip off trailing "/node.def\n" from file pathname
+ my $line = substr($f, 0, -10);
+
+ # Strip off leading "/opt/vyatta/share/vyatta-cfg/templates/"
+ $line = substr($line, 39);
+
+ # See if there is a comment in entry
+ my ($entry, $comment) = split /#/, $result;
+ if (defined $comment) {
+ $comment =~ s/\n//;
+ $line = $line . " #" . $comment;
+ }
+
+ # stuff resulting line into hash
+ push @{$pri{$r[1]}}, $line;
+ }
}
}
@@ -21,8 +34,6 @@ foreach my $f (@files) {
foreach my $key ( sort { $a <=> $b } keys %pri ) {
my @a = @{$pri{$key}};
foreach my $val (@a) {
- my $loc = substr($val,0,-10);
- my $loc = substr($loc,39);
- print $key," ",$loc,"\n";
+ print $key," ",$val,"\n";
}
}