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