1 | #!/usr/bin/perl -w
|
---|
2 | #
|
---|
3 | # $Id$
|
---|
4 | # Copyright B. Cornec 2005-today
|
---|
5 | # Provided under the GPL v2
|
---|
6 | #
|
---|
7 | # Get the value of the parameter passed in argument for the distribution concerned
|
---|
8 | #
|
---|
9 | use strict 'vars';
|
---|
10 | use ProjectBuilder::Base;
|
---|
11 | use ProjectBuilder::Version;
|
---|
12 | use ProjectBuilder::Distribution;
|
---|
13 | use ProjectBuilder::Conf;
|
---|
14 | use MondoRescue::Base;
|
---|
15 | use Data::Dumper;
|
---|
16 | use Getopt::Long qw(:config auto_abbrev no_ignore_case);
|
---|
17 | use English;
|
---|
18 |
|
---|
19 |
|
---|
20 | =pod
|
---|
21 |
|
---|
22 | =head1 NAME
|
---|
23 |
|
---|
24 | mr-getdistro get MondoRescue parameter
|
---|
25 |
|
---|
26 | =head1 DESCRIPTION
|
---|
27 |
|
---|
28 | mr-getdistro get a MondoRescue parameter from configuration files for a specific distribution
|
---|
29 |
|
---|
30 | =head1 SYNOPSIS
|
---|
31 |
|
---|
32 | mr-getdistro [-v][-h] param
|
---|
33 |
|
---|
34 | =head1 ARGUMENTS
|
---|
35 |
|
---|
36 | =over 4
|
---|
37 |
|
---|
38 | =item B<param>
|
---|
39 |
|
---|
40 | This is the parameter whose value should be returned
|
---|
41 |
|
---|
42 | =back
|
---|
43 |
|
---|
44 | =head1 OPTIONS
|
---|
45 |
|
---|
46 | =over 4
|
---|
47 |
|
---|
48 | =item B<-v|--verbose>
|
---|
49 |
|
---|
50 | Increase verbosity
|
---|
51 |
|
---|
52 | =item B<-h|--help>
|
---|
53 |
|
---|
54 | Print a brief help message and exits.
|
---|
55 |
|
---|
56 | =item B<--man>
|
---|
57 |
|
---|
58 | Prints the manual page and exits.
|
---|
59 |
|
---|
60 | =back
|
---|
61 |
|
---|
62 | =head1 WEB SITES
|
---|
63 |
|
---|
64 | The main Web site of the project is available at L<http://www.mondorescue.org>. Bug reports should be filled using the trac instance of the project at L<http://trac.mondorescue.org/>.
|
---|
65 |
|
---|
66 | =head1 USER MAILING LIST
|
---|
67 |
|
---|
68 | For community exchanges around MondoRescue please use the list L<http://sourceforge.net/mailarchive/forum.php?forum_name=mondo-devel>
|
---|
69 |
|
---|
70 | =head1 AUTHORS
|
---|
71 |
|
---|
72 | The MondoRescue team lead by Bruno Cornec L<mailto:bruno@mondorescue.org>.
|
---|
73 |
|
---|
74 | =head1 COPYRIGHT
|
---|
75 |
|
---|
76 | MondoRescue is distributed under the GPL v2.0 license or later,
|
---|
77 | described in the file C<COPYING> included with the distribution.
|
---|
78 |
|
---|
79 | =cut
|
---|
80 |
|
---|
81 | # Global variables
|
---|
82 | my ($mrver,$mrrev) = pb_version_init();
|
---|
83 | my $appname = "mr-getdistro";
|
---|
84 | my %opts; # CLI Options
|
---|
85 |
|
---|
86 | # Initialize the syntax string
|
---|
87 |
|
---|
88 | pb_syntax_init("$appname Version $mrver-$mrrev\n");
|
---|
89 |
|
---|
90 | GetOptions("help|?|h" => \$opts{'h'},
|
---|
91 | "man" => \$opts{'man'},
|
---|
92 | "verbose|v+" => \$opts{'v'},
|
---|
93 | ) || pb_syntax(-1,0);
|
---|
94 |
|
---|
95 | if (defined $opts{'h'}) {
|
---|
96 | pb_syntax(0,1);
|
---|
97 | }
|
---|
98 | if (defined $opts{'man'}) {
|
---|
99 | pb_syntax(0,2);
|
---|
100 | }
|
---|
101 | if (defined $opts{'v'}) {
|
---|
102 | $pbdebug++;
|
---|
103 | }
|
---|
104 |
|
---|
105 | mr_init();
|
---|
106 | my $pbos = pb_distro_get_context();
|
---|
107 | my @rep = pb_distro_get_param($pbos,pb_conf_get_if(@ARGV));
|
---|
108 | my $i = 0;
|
---|
109 | while ($i le $#ARGV) {
|
---|
110 | pb_log(1, "Param #$i for $ARGV[$i] => $rep[$i]\n");
|
---|
111 | print "$rep[$i]\n" if ($pbdebug lt 1);
|
---|
112 | $i++
|
---|
113 | }
|
---|