#!/usr/bin/perl -w # # wrancid - Wrapper script for all the devices without a proper cli but # for which there is an other way to get to the config file. # # WARNING: This is only PROOF OF CONCEPT code and will screw up your data # and eat babies!!! # # Copyright 2005 Michael Stefaniuc for Red Hat # # This script is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # 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. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # use strict; use Getopt::Std; ############# # Variables # ############# #my $plugin_dir = '/usr/local/rancid/share/wrapper'; my $plugin_dir = "$ENV{\"HOME\"}share/wrapper"; my %options = (); getopts("f:s:", \%options); my $host = $ARGV[0]; my $script = $options{'s'}; my $file; if (defined($options{'f'})) { $file = $options{'f'}; } else { $file = $host . ".new"; } # Call the plugin script and let it do the work exec("$plugin_dir/$script", "-f", $file, $host) or die "Couldn't execute the '$plugin_dir/$script' script!\n";