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

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