source: MondoRescue/branches/3.3/MondoRescue/bin/mr-distro-getparam@ 3650

Last change on this file since 3650 was 3650, checked in by Bruno Cornec, 7 years ago
  • Fix versions given back for mr-* tools
  • Log pb and mr versions in mindi log
  • mr-getparam now prints a version
  • Property svn:executable set to *
File size: 2.2 KB
Line 
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#
9use strict 'vars';
10use ProjectBuilder::Base;
11use ProjectBuilder::Version;
12use ProjectBuilder::Distribution;
13use ProjectBuilder::Conf;
14use MondoRescue::Version;
15use MondoRescue::Base;
16use Data::Dumper;
17use Getopt::Long qw(:config auto_abbrev no_ignore_case);
18use English;
19
20
21=pod
22
23=head1 NAME
24
25mr-getdistro get MondoRescue parameter
26
27=head1 DESCRIPTION
28
29mr-getdistro get a MondoRescue parameter from configuration files for a specific distribution
30
31=head1 SYNOPSIS
32
33mr-getdistro [-v][-h] param
34
35=head1 ARGUMENTS
36
37=over 4
38
39=item B<param>
40
41This 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
51Increase verbosity
52
53=item B<-h|--help>
54
55Print a brief help message and exits.
56
57=item B<--man>
58
59Prints the manual page and exits.
60
61=back
62
63=head1 WEB SITES
64
65The 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
69For community exchanges around MondoRescue please use the list L<http://sourceforge.net/mailarchive/forum.php?forum_name=mondo-devel>
70
71=head1 AUTHORS
72
73The MondoRescue team lead by Bruno Cornec L<mailto:bruno@mondorescue.org>.
74
75=head1 COPYRIGHT
76
77MondoRescue is distributed under the GPL v2.0 license or later,
78described in the file C<COPYING> included with the distribution.
79
80=cut
81
82# Global variables
83my ($mrver,$mrrev) = mr_version_init();
84my $appname = "mr-getdistro";
85my %opts; # CLI Options
86
87# Initialize the syntax string
88
89pb_syntax_init("$appname Version $mrver-$mrrev\n");
90
91GetOptions("help|?|h" => \$opts{'h'},
92 "man" => \$opts{'man'},
93 "verbose|v+" => \$opts{'v'},
94) || pb_syntax(-1,0);
95
96if (defined $opts{'h'}) {
97 pb_syntax(0,1);
98}
99if (defined $opts{'man'}) {
100 pb_syntax(0,2);
101}
102if (defined $opts{'v'}) {
103 $pbdebug++;
104}
105
106mr_init();
107my $pbos = pb_distro_get_context();
108my @rep = pb_distro_get_param($pbos,pb_conf_get_if(@ARGV));
109my $i = 0;
110while ($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 }
Note: See TracBrowser for help on using the repository browser.