#!/usr/bin/perl -w
#
# $Id$
# Copyright B. Cornec 2005-today
# Provided under the GPL v2
#
# Get the value of the parameter passed in argument for the distribution concerned
#
use strict 'vars';
use ProjectBuilder::Base;
use ProjectBuilder::Version;
use ProjectBuilder::Distribution;
use ProjectBuilder::Conf;
use MondoRescue::Version;
use MondoRescue::Base;
use Data::Dumper;
use Getopt::Long qw(:config auto_abbrev no_ignore_case);
use English;
=pod
=head1 NAME
mr-getdistro get MondoRescue parameter
=head1 DESCRIPTION
mr-getdistro get a MondoRescue parameter from configuration files for a specific distribution
=head1 SYNOPSIS
mr-getdistro [-v][-h] param
=head1 ARGUMENTS
=over 4
=item B
This is the parameter whose value should be returned
=back
=head1 OPTIONS
=over 4
=item B<-v|--verbose>
Increase verbosity
=item B<-h|--help>
Print a brief help message and exits.
=item B<--man>
Prints the manual page and exits.
=back
=head1 WEB SITES
The main Web site of the project is available at L. Bug reports should be filled using the trac instance of the project at L.
=head1 USER MAILING LIST
For community exchanges around MondoRescue please use the list L
=head1 AUTHORS
The MondoRescue team lead by Bruno Cornec L.
=head1 COPYRIGHT
MondoRescue is distributed under the GPL v2.0 license or later,
described in the file C included with the distribution.
=cut
# Global variables
my ($mrver,$mrrev) = mr_version_init();
my $appname = "mr-getdistro";
my %opts; # CLI Options
# Initialize the syntax string
pb_syntax_init("$appname Version $mrver-$mrrev\n");
GetOptions("help|?|h" => \$opts{'h'},
"man" => \$opts{'man'},
"verbose|v+" => \$opts{'v'},
) || pb_syntax(-1,0);
if (defined $opts{'h'}) {
pb_syntax(0,1);
}
if (defined $opts{'man'}) {
pb_syntax(0,2);
}
if (defined $opts{'v'}) {
$pbdebug++;
}
mr_init();
my $pbos = pb_distro_get_context();
my @rep = pb_distro_get_param($pbos,pb_conf_get_if(@ARGV));
my $i = 0;
while ($i le $#ARGV) {
pb_log(1, "Param #$i for $ARGV[$i] => $rep[$i]\n");
print "$rep[$i]\n" if ($pbdebug lt 1);
$i++
}