summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2025-11-25 17:41:16 +0000
committerDaniil Baturin <daniil@baturin.org>2025-11-25 18:14:52 +0000
commit4a1b8af73a24d2d3380d94331ece2156c1b9f043 (patch)
tree1ab58422983eaa4dd839e1a611f50f8287614bdf /scripts
parentb1dde1ca05edd62ae50159b155e3a94af1bef53d (diff)
downloadvyatta-cfg-4a1b8af73a24d2d3380d94331ece2156c1b9f043.tar.gz
vyatta-cfg-4a1b8af73a24d2d3380d94331ece2156c1b9f043.zip
misc: T8041: remove the old priority.pl script
that is superseded by a proper VyOS utility
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/priority.pl96
1 files changed, 0 insertions, 96 deletions
diff --git a/scripts/priority.pl b/scripts/priority.pl
deleted file mode 100755
index 412b600..0000000
--- a/scripts/priority.pl
+++ /dev/null
@@ -1,96 +0,0 @@
-#!/usr/bin/perl
-
-# Read all the configuration templates in the configuration
-# template directory and produce an ordered list of the priority
-# of configuration actions
-
-use strict;
-use warnings;
-use File::Find;
-
-my %priorities;
-my @parent_priorities;
-
-# Open node file and extract priority and comment if any
-sub get_priority {
- open( my $f, '<', $_ )
- or return;
- my $priority;
- my $comment;
-
- while (<$f>) {
- chomp;
- next unless m/^priority:\s((PARENT)|(\d+))/;
- $priority = $1;
-
- $comment = $1 if (/#(.*)$/);
-
- last;
- }
- close $f;
- return ( $priority, $comment );
-}
-
-# Called by find and returns true iff
-# file is named node.def
-# file contains priority tag
-# Side effect: tores resulting line in $priorities hash for display
-sub wanted {
- return unless ( $_ eq 'node.def' );
-
- my ( $priority, $comment ) = get_priority($File::Find::name);
- return unless $priority;
-
- my $dir = $File::Find::dir;
- $dir =~ s/^.*\/templates\///;
-
- $dir .= " #" . $comment
- if $comment;
-
- # append line to list of entries with same priority
- if ($priority ne 'PARENT') {
- push @{ $priorities{$priority} }, $dir;
- }
- else {
- push(@parent_priorities, $dir);
- }
- return 1;
-}
-
-# main program
-my $cfgdir = '/opt/vyatta/share/vyatta-cfg/templates';
-$cfgdir = $ARGV[0] if $#ARGV == 0;
-die "$cfgdir does not exist!" unless -d $cfgdir;
-
-# walk config file tree
-find( \&wanted, $cfgdir );
-
-#resolve parent dependencies
-foreach my $pp (@parent_priorities) {
- my $tmp = $pp;
- while (1) {
- my $pos = rindex($tmp, "/");
- if ($pos == -1) {
- last;
- }
- $tmp = substr($tmp,0,$pos);
-
- #search through second value in collection for match
- foreach (keys %priorities) {
- foreach my $a (@{ $priorities{$_} }) {
- if ($a eq $tmp) {
- push @{ $priorities{$_} }, $pp . " [PARENT]";
- last;
- }
- }
- }
- }
-}
-
-# display resulting priorities
-foreach my $key ( sort { $a <=> $b } keys %priorities ) {
- my @a = @{ $priorities{$key} };
- foreach my $val ( sort @a ) {
- print $key, " ", $val, "\n";
- }
-}