Changeset 2659 in MondoRescue for devel/mr


Ignore:
Timestamp:
Jun 23, 2010, 4:26:59 PM (14 years ago)
Author:
Bruno Cornec
Message:

r3911@wsip-70-165-196-181: bruno | 2010-06-22 03:34:20 +0200

  • First packaged version of a mrmin version begining to work (but doing nothing interesting yet ;-)
Location:
devel/mr
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • devel/mr/Makefile.PL

    r2650 r2659  
    99    VERSION   => 'PBVER',
    1010    INST_SCRIPT  => 'blib/bin',
    11     INSTALLDIRS  => 'perl',
     11    INSTALLDIRS  => 'vendor',
    1212    PREREQ_PM   => {
    1313            #HTTP::Headers                  => 1.59,
     
    6161            $target = "/usr/local";
    6262            if (not defined $confdir) {
    63                 $confdir = "/usr/local/etc";
     63                $confdir = "$target/etc";
     64            }
     65            if (not defined $cachedir) {
     66                $cachedir = "$target/var/cache";
    6467            }
    6568        } else {
    66             $sharedir = $sharedir || "$target/share";
    67             $mandir = $mandir || "$sharedir/man";
    6869            $cachedir = $cachedir || "$target/var/cache";
    6970            if (not defined $confdir) {
    7071                die "CONFDIR should be defined if PREFIX is defined";
    7172            }
     73            if (not defined $cachedir) {
     74                die "CACHEDIR should be defined if PREFIX is defined";
     75            }
    7276        }
     77        $sharedir = $sharedir || "$target/share";
     78        $mandir = $mandir || "$sharedir/man";
    7379
    7480        my $conff = "etc/PBPROJ.conf";
     
    8389mr_install_dir default = $target
    8490#
    85 #
    8691# conf dir
    8792#
     
    95100#
    96101mr_share_dir default = $sharedir/PBPROJ
     102#
     103# version
     104#
     105mr_version default = PBVER-rPBREV
    97106EOF
    98107        close(CONF);
     
    102111
    103112        $text .= "install ::\n";
    104         $text .= "\t".'@echo PBPKG PBVER-PBREV will be installed under $(DESTDIR)'."\n";
     113        $text .= "\t".'@echo PBPKG PBVER-rPBREV will be installed under $(DESTDIR)'."\n";
    105114        $text .= "\t".'install -m 755 -d $(DESTDIR)'."$confdir/PBPROJ".' $(DESTDIR)'."$cachedir/PBPROJ".' $(DESTDIR)'."$sharedir/PBPROJ\n";
    106115        $text .= "\t".'cp etc/PBPROJ.conf $(DESTDIR)'."$confdir/PBPROJ/PBPROJ.conf.dist ; install -m 755 -d ".' $(DESTDIR)'."$mandir/man5 ; pod2man etc/PBPROJ.conf > ".'$(DESTDIR)'."$mandir/man5/PBPROJ.conf.5\n";
    107116        $text .= "\t".'md5sum $(DESTDIR)'."$confdir/PBPROJ/PBPROJ.conf.dist > ".'$(DESTDIR)'."$confdir/PBPROJ/PBPROJ.conf.dist.md5\n";
    108         $text .= "\t".'cp lib/MondoRescue/DynConf.pm $(DESTDIR)/$(INST_LIBDIR)/'."\n";
    109         $text .= "\t".'md5sum $(DESTDIR)'."$confdir/PBPROJ/PBPROJ.conf.dist > ".'$(DESTDIR)'."$confdir/PBPROJ/PBPROJ.conf.dist.md5\n";
    110         #$text .= "\t".'if [ -f etc/PBKG.conf ]; then cp etc/PBPKG.conf $(DESTDIR)'."$confdir/PBPROJ/PBKG.conf.dist ; install -m 755 -d ".' $(DESTDIR)'."$mandir/man5 ; pod2man etc/PBPKG.conf > ".'$(DESTDIR)'."$mandir/man5/PBPKG.conf.5 ; fi\n";
    111         #$text .= "\t".'md5sum $(DESTDIR)'."$confdir/PBPROJ/PBPKG.conf.dist > ".'$(DESTDIR)'."$confdir/PBPROJ/PBPKG.conf.dist.md5\n";
     117        $text .= "\t".'cp lib/MondoRescue/DynConf.pm $(DESTDIR)/$(VENDORLIBEXP)/MondoRescue/'."\n";
    112118
    113119        # Now generate a perl module used by every other one in the project
     
    152158
    153159This function returns all the installation PATH info needed by the project
    154 It takes no parameter and returns 3 values
     160It takes no parameter and returns 2 values
    155161First value is the conf dir
    156162Second value is the project name
     
    159165
    160166sub mr_dynconf_init {
    161     return($confdir,PBPROJ);
     167    return("$confdir/PBPROJ","PBPROJ");
    162168}
    1631691;
  • devel/mr/etc/mondorescue.conf

    r2650 r2659  
    2020mr_fstab default = /etc/fstab
    2121
     22#
     23# Interface to burner
     24#
     25mr_burn_cmd default = /usr/bin/wodim
     26#mr_burn_cmd default = /usr/bin/cdrecord
     27
     28mr_burn_opt default = -v
    2229#
    2330# LVM commands and conf files
  • devel/mr/lib/MondoRescue/Base.pm

    r2650 r2659  
    2525use Exporter;
    2626
     27# Global hash for configuration params of mr
     28my %mr;
     29our $mr = \%mr;
     30
    2731# Export, by default, all the functions into the namespace of
    2832# any code which uses this module.
    2933
    3034our @ISA = qw(Exporter);
    31 our @EXPORT = qw(mr_init mr_exit);
     35our @EXPORT = qw(mr_init mr_exit mr_conf_get $mr);
    3236
    3337=pod
     
    7175#
    7276# Conf files Management
    73 # the $MRMINI_CONF/mondorescue.conf.dist is delivered as part of the project and
     77# the $etcdir/mondorescue.conf.dist is delivered as part of the project and
    7478# its checksum is verified as we need good default values that we can trust
    7579#
     
    106110exit($code);
    107111}
     112
     113=item B<mr_conf_get>
     114
     115This function get parameters in configuration files and returns from the least significant level (default) to the emost significant level (application name), passing by the project name.
     116It takes a list of parameters to find and returns the values corresponding
     117
     118=cut
     119
     120
     121sub mr_conf_get {
     122    my @params = @_;
     123    my @ptr = ();
     124    my $ptr;
     125   
     126    pb_log(2,"Entering mr_conf_get\n");
     127    my @args1 = pb_conf_get_if(@params);
     128    my $proj = $ENV{'PBPROJ'};
     129    $ENV{'PBPROJ'} = $ENV{'PBPKG'};
     130    my @args2 = pb_conf_get_if(@params);
     131    foreach my $i (0..$#args1) {
     132        $ptr = undef;
     133        # Process from least important to more important
     134        $ptr = $args1[$i]->{'default'};
     135        $ptr[$i] = $ptr if (defined $ptr);
     136        $ptr = $args1[$i]->{$ENV{'PBPROJ'}};
     137        $ptr[$i] = $ptr if (defined $ptr);
     138        $ptr = $args2[$i]->{$ENV{'PBPKG'}};
     139        $ptr[$i] = $ptr if (defined $ptr);
     140        $ptr[$i] = "Undefined" if (not defined $ptr[$i]);
     141        pb_log(2,"Found parameter $params[$i] with value $ptr[$i]\n");
     142    }
     143    $ENV{'PBPROJ'} = $proj;
     144    return(@ptr);
     145}
Note: See TracChangeset for help on using the changeset viewer.