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