summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/enumeration/existing-interfaces4
-rwxr-xr-xscripts/helpstring.pl78
-rwxr-xr-xscripts/update-helpstring.pl70
-rwxr-xr-xscripts/update-priority.pl75
-rwxr-xr-xscripts/vyatta-cli-expand-var.pl83
-rwxr-xr-xscripts/vyatta-find-type.pl39
-rwxr-xr-xscripts/vyatta-output-config.pl39
-rwxr-xr-xscripts/vyatta-strip-migration-comments.pl73
8 files changed, 0 insertions, 461 deletions
diff --git a/scripts/enumeration/existing-interfaces b/scripts/enumeration/existing-interfaces
deleted file mode 100755
index 1defc22..0000000
--- a/scripts/enumeration/existing-interfaces
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-
-ls /sys/class/net 2>/dev/null
-
diff --git a/scripts/helpstring.pl b/scripts/helpstring.pl
deleted file mode 100755
index 6d50308..0000000
--- a/scripts/helpstring.pl
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/usr/bin/perl
-
-# Author: Arthur Xiong
-# Date: 06/21/2010
-# Description: Script to generate Vyatta command help strings from
-# template files
-
-# **** License ****
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# This code was originally developed by Vyatta, Inc.
-# Portions created by Vyatta are Copyright (C) 2006-2010 Vyatta, Inc.
-# All Rights Reserved.
-#
-# **** End License ****
-
-use strict;
-use warnings;
-use File::Find;
-
-my @command_line;
-my $cfgdir;
-my $feature_name="";
-
-#
-sub get_parameter {
- open my $nd, '<', $_ or die "$_ can't be opened";
- my $help_string = "";
-
- while (<$nd>) {
- next unless /^help:\s*(\S.*)$/;
- $help_string .= "\|$1" if /^help:\s*(\S.*)$/;
- last;
- }
- close $nd;
- return $help_string;
-}
-
-#
-# Generate command with parameter
-#
-sub wanted {
- return unless ( $_ eq 'node.def' );
- my $parameter = get_parameter($File::Find::name);
-
- my $dir = $File::Find::dir;
- return if $dir =~ /^.*\/\.\S(|-)\S*\/?.*$/;
- if ( $feature_name ne "" ) {
- return unless $dir =~ /^.*\/$feature_name(|\/.*)$/;
- }
-
- $dir =~ s/^.*\/(|\S*\-)(templates)(|\-(cfg|op))\///;
-# $dir =~ s/\// /g;
- $dir .= " " . $parameter . "\n";
-
- push @command_line, $dir;
- return 1;
-}
-
-# main program
-
-die "Usage: helpstring.pl <path-to-template> [<feature-name>]"
- unless $#ARGV == 0 or $#ARGV == 1;
-$cfgdir = $ARGV[0];
-$feature_name = $ARGV[1] if $#ARGV == 1;
-die "$cfgdir does not exist!" unless -d $cfgdir;
-
-# walk template file tree
-find( \&wanted, $cfgdir );
-
-print @command_line;
diff --git a/scripts/update-helpstring.pl b/scripts/update-helpstring.pl
deleted file mode 100755
index 54a0eb1..0000000
--- a/scripts/update-helpstring.pl
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/usr/bin/perl
-
-# Author: Arthur Xiong
-# Date: 06/21/2010
-# Description: Script to automatically update help string for each
-# node.def according to the inputs
-
-# **** License ****
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# This code was originally developed by Vyatta, Inc.
-# Portions created by Vyatta are Copyright (C) 2006-2010 Vyatta, Inc.
-# All Rights Reserved.
-#
-# **** End License ****
-
-use strict;
-use warnings;
-
-die "Usage: update-helpstring.pl <helpstring-file> <path-to-template>"
- unless $#ARGV == 1;
-
-my $helpstring;
-my $path;
-my $comment;
-my $help_line;
-my $node_def;
-my $helpstring_file = $ARGV[0];
-my $prefix = $ARGV[1];
-
-open my $hf, '<', $helpstring_file or die "$helpstring_file can't be opened";
-while (<$hf>) {
- chomp;
- next if /^#.*/ or /^\s*$/;
- die "Syntax Error \"$_\"" unless /^(\S+)\s+\|\s*(\S.*)$/;
- $path = $1;
- $helpstring = $2;
-
- $help_line = "";
- $help_line = "help: " . $helpstring . "\n";
- print "$help_line";
-
- $node_def = "";
- $node_def = $prefix . "/" . $path . "/" . "node.def";
-
- 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>) {
- if ( /^help:/ ) {
- print $nfn $help_line;
- } else {
- print $nfn $_;
- }
- }
- close $nfn;
- close $nf;
-
- rename "$node_def.new", "$node_def"
- or die "$node_def.new can't be renamed to $node_def";
-
- print "Updated $node_def\n\n";
-}
-close $hf;
diff --git a/scripts/update-priority.pl b/scripts/update-priority.pl
deleted file mode 100755
index feb1e7f..0000000
--- a/scripts/update-priority.pl
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/usr/bin/perl
-
-# Author: Arthur Xiong
-# Date: 04/15/2010
-# Description: Script to automatically update/add priority tag with
-# some value for each node.def according to the inputs
-
-# **** License ****
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# This code was originally developed by Vyatta, Inc.
-# Portions created by Vyatta are Copyright (C) 2006-2010 Vyatta, Inc.
-# All Rights Reserved.
-#
-# **** End License ****
-
-use strict;
-use warnings;
-
-die "Usage: update-priority.pl <priority-file> <path-to-template>"
- unless $#ARGV == 1;
-
-my $priority;
-my $path;
-my $comment;
-my $priority_line;
-my $node_def;
-my $priority_file = $ARGV[0];
-my $prefix = $ARGV[1];
-
-open my $pf, '<', $priority_file or die "$priority_file can't be opened";
-while (<$pf>) {
- chomp;
- next if /^#.*/ or /^$/;
- die "Syntax Error \"$_\"" unless /^(\d+)\s+(\S+)(|\s+|\s+#.*)$/;
- $priority = $1;
- $path = $2;
- $comment = $3;
-
- $priority_line = "";
- $priority_line = "priority: " . $priority . "\t" . $comment . "\n";
- print "priority_line: $priority_line";
-
- $node_def = "";
- $node_def = $prefix . "/" . $path . "/" . "node.def";
- print "node_def: ", $node_def, "\n";
-
- 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>) {
- 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+)/;
- }
- close $nfn;
- close $nf;
-
- rename "$node_def.new", "$node_def"
- or die "$node_def.new can't be renamed to $node_def";
-
- print "Updated $node_def\n\n";
-}
-close $pf;
diff --git a/scripts/vyatta-cli-expand-var.pl b/scripts/vyatta-cli-expand-var.pl
deleted file mode 100755
index f3bda2d..0000000
--- a/scripts/vyatta-cli-expand-var.pl
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/usr/bin/perl
-
-# Author: An-Cheng Huang <ancheng@vyatta.com>
-# Date: 2007
-# Description: bash expand script
-
-# **** License ****
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# This code was originally developed by Vyatta, Inc.
-# Portions created by Vyatta are Copyright (C) 2006, 2007, 2008 Vyatta, Inc.
-# All Rights Reserved.
-# **** End License ****
-
-use strict;
-use lib "/opt/vyatta/share/perl5/";
-use Vyatta::Config;
-
-# expand a variable reference
-if ($#ARGV != 0) {
- print STDERR "usage: vyatta-cli-expand-var.pl '<var-ref>'\n";
- exit 1;
-}
-
-$_ = $ARGV[0];
-
-# basic format check:
-# '(' ')' not allowed in reference.
-# only allow absolute path for now.
-if (!/^\$VAR\(\/([^()]+)\)$/) {
- print STDERR "invalid variable reference (invalid format)\n";
- exit 1;
-}
-$_ = $1;
-
-my $multi_val = 1;
-if (s/^(.*)\/\@\@$/$1/) {
- # return list of multi-node values
- $multi_val = 1;
-} elsif (s/^(.*)\/\@$/$1/) {
- # return single value
- $multi_val = 0;
-} else {
- # only allow the above 2 forms for now.
- print STDERR "invalid variable reference (invalid value specification)\n";
- exit 1;
-}
-
-if (/\@/) {
- # '@' not allowed anywhere else in the reference for now.
- print STDERR "invalid variable reference (extra value specification)\n";
- exit 1;
-}
-
-my $config = new Vyatta::Config;
-my $path_str = join ' ', (split /\//);
-my $val_str = "";
-if ($multi_val) {
- my @tmp = $config->returnOrigValues($path_str);
- if (scalar(@tmp) > 0) {
- # we got multiple values back
- $val_str = join ' ', @tmp;
- } else {
- # this node may be a 'tag' node. try listing children.
- $config->setLevel($path_str);
- @tmp = $config->listOrigNodes();
- $val_str = join ' ', @tmp;
- }
-} else {
- $val_str = $config->returnOrigValue($path_str);
-}
-
-# expanded string is printed on stdout (multiple values separated by ' ').
-print "$val_str";
-exit 0;
-
diff --git a/scripts/vyatta-find-type.pl b/scripts/vyatta-find-type.pl
deleted file mode 100755
index 9621a58..0000000
--- a/scripts/vyatta-find-type.pl
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/usr/bin/perl
-
-# Author: An-Cheng Huang <ancheng@vyatta.com>
-# Date: 2007
-# Description: bash tyep checking for Vyatta configuration commands
-
-# **** License ****
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# This code was originally developed by Vyatta, Inc.
-# Portions created by Vyatta are Copyright (C) 2006, 2007, 2008 Vyatta, Inc.
-# All Rights Reserved.
-# **** End License ****
-
-use strict;
-use lib "/opt/vyatta/share/perl5/";
-use Vyatta::TypeChecker;
-
-# find the type of a value (from a list of candidates)
-if ($#ARGV < 1) {
- print "usage: vyatta-find-type.pl <value> <type> [<type> ...]\n";
- exit 1;
-}
-
-if (my $type = Vyatta::TypeChecker::findType(@ARGV)) {
- # type found
- print "$type";
- exit 0;
-}
-
-# value not valid for any of the candidates
-exit 1;
diff --git a/scripts/vyatta-output-config.pl b/scripts/vyatta-output-config.pl
deleted file mode 100755
index a632297..0000000
--- a/scripts/vyatta-output-config.pl
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/usr/bin/perl
-
-# Author: An-Cheng Huang <ancheng@vyatta.com>
-# Date: 2007
-# Description: Script to output the configuration
-
-# **** License ****
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# This code was originally developed by Vyatta, Inc.
-# Portions created by Vyatta are Copyright (C) 2006, 2007, 2008 Vyatta, Inc.
-# All Rights Reserved.
-# **** End License ****
-
-use strict;
-use lib "/opt/vyatta/share/perl5";
-use Vyatta::ConfigOutput;
-
-if ($ARGV[0] eq '-all') {
- shift;
- set_show_all(1);
-}
-
-if ($ARGV[0] eq '-active') {
- shift;
- set_hide_password(1);
- outputActiveConfig(@ARGV);
-} else {
- outputNewConfig(@ARGV);
-}
-
-exit 0;
diff --git a/scripts/vyatta-strip-migration-comments.pl b/scripts/vyatta-strip-migration-comments.pl
deleted file mode 100755
index 21fcc89..0000000
--- a/scripts/vyatta-strip-migration-comments.pl
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/usr/bin/perl
-
-# Author: Michael Larson <mike@vyatta.com>
-# Date: 2010
-# Description: Perl script for activating/deactivating portions of the configuration
-
-# **** License ****
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# This code was originally developed by Vyatta, Inc.
-# Portions created by Vyatta are Copyright (C) 2006, 2007, 2008, 2009, 2010 Vyatta, Inc.
-# All Rights Reserved.
-# **** End License ****
-
-use strict;
-use warnings;
-use File::Copy;
-
-# Looking for a comment something like this...
-#
-# /* --- CONFIGURATION COMMENTED OUT DURING MIGRATION BELOW ---
-# resp-time 5
-# --- CONFIGURATION COMMENTED OUT DURING MIGRATION ABOVE --- */
-#
-#
-#
-
-my $file = $ARGV[0];
-
-if (!defined $file) {
- $file = "/opt/vyatta/etc/config/config.boot";
-}
-
-my $backup = "$file.boot.strip-migration-comments-bu";
-print "copying original configuration $file to $backup\n";
-cp($file, $backup)
- or die "Error! Unable to copy $file to $backup: $!";
-
-open(my $inputfile, '<', $file)
- or die "Error! Unable to open file for input \"$file\". $!";
-
-my $contents = "";
-my $in_mig_com = 0;
-while(<$inputfile>) {
- if ($_ =~ /CONFIGURATION COMMENTED OUT DURING MIGRATION BELOW/) {
- $in_mig_com = 1;
- }
- elsif ($_ =~ /CONFIGURATION COMMENTED OUT DURING MIGRATION ABOVE/) {
- $in_mig_com = 0;
- }
- elsif ($in_mig_com == 1) {
- #do nothing here
- }
- else {
- $contents .= $_;
- }
-}
-close($inputfile);
-
-open(my $outputfile, '>', $file)
- or die "Error! Unable to open file for output \"$file\". $!";
-
-print $outputfile $contents;
-close($outputfile);
-
-print "done\n";