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