Changeset 3644 in MondoRescue


Ignore:
Timestamp:
Jan 3, 2017, 2:04:51 AM (7 years ago)
Author:
Bruno Cornec
Message:
  • 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
Location:
branches/3.3/MondoRescue
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • branches/3.3/MondoRescue/Makefile.PL

    r3553 r3644  
    2626                bin/mr-net-get-config
    2727                bin/mr-label
     28                bin/mr-getparam
     29                bin/mr-distro-getparam
    2830                ) ],
    2931);
  • branches/3.3/MondoRescue/etc/mondorescue.conf

    r3239 r3644  
    7474mr_cmd_lshw linux = /usr/sbin/lshw
    7575# Pb of key here want both linux and mrmini or mondoarchive or ...
    76 mr_cmd_mkisofs linux = /usr/bin/mkisofs
    77 mr_opt_mkisofs linux = -J -r -v -p MondoRescue -publisher http://www.mondorescue.org -A MondoRescue
     76mr_cmd_mkiso linux = /usr/bin/mkisofs
     77mr_opt_mkiso linux = -J -r -v -p MondoRescue -publisher http://www.mondorescue.org -A MondoRescue
     78mr_cmd_mkiso mageia = /usr/bin/xorriso
    7879
    7980#
     
    9798# =head1 COPYRIGHT
    9899
    99 # (c) B. Cornec 2007-2014
     100# (c) B. Cornec 2007-today
    100101#
    101102# Provided under the Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) Creative Common License
  • branches/3.3/MondoRescue/lib/MondoRescue/Base.pm

    r3219 r3644  
    6161my $msg = shift || "";
    6262
    63 pb_log_init($pbdebug);
     63pb_log_init($pbdebug, $pbLOG);
    6464
    6565if (defined $msg) {
     
    6767}
    6868
     69# Temp dir
     70pb_temp_init($pbdebug);
    6971
    7072my $pbproj;
     
    7274($mr->{'confdir'},$pbproj) = mr_dynconf_init();
    7375
    74 # Temp dir
    75 pb_temp_init();
     76# First setup the PBPRJ env var
     77pb_conf_init($pbproj);
    7678
    77 # First use the main configuration file
    78 pb_conf_init($pbproj);
    79 $ENV{'PBPROJ'} = $pbproj;
    8079#
    8180# Conf files Management
     
    141140    pb_log(2,"Entering mr_conf_get\n");
    142141    my @args1 = pb_conf_get_if(@params);
     142    my @args2 = ();
    143143    my $proj = $ENV{'PBPROJ'};
    144     $ENV{'PBPROJ'} = $ENV{'PBPKG'};
    145     my @args2 = pb_conf_get_if(@params);
     144    if (defined $ENV{'PBPKG'}) {
     145        $ENV{'PBPROJ'} = $ENV{'PBPKG'};
     146        @args2 = pb_conf_get_if(@params);
     147        $ENV{'PBPROJ'} = $proj;
     148    }
    146149    foreach my $i (0..$#args1) {
    147150        $ptr = undef;
    148151        # Process from least important to more important
    149         $ptr = $args1[$i]->{'default'};
    150         $ptr[$i] = $ptr if (defined $ptr);
    151         $ptr = $args1[$i]->{$ENV{'PBPROJ'}};
    152         $ptr[$i] = $ptr if (defined $ptr);
    153         $ptr = $args2[$i]->{$ENV{'PBPKG'}};
    154         $ptr[$i] = $ptr if (defined $ptr);
     152        if (defined $args1[$i]->{'default'}) {
     153            $ptr[$i] = $args1[$i]->{'default'};
     154        }
     155        if (defined $args1[$i]->{$ENV{'PBPROJ'}}) {
     156            $ptr[$i] = $args1[$i]->{$ENV{'PBPROJ'}};
     157        }
     158        if ((defined $ENV{'PBPKG'}) and (defined $args2[$i]) and (defined $args2[$i]->{$ENV{'PBPKG'}})) {
     159            $ptr[$i] = $args2[$i]->{$ENV{'PBPKG'}};
     160        }
    155161        $ptr[$i] = "Undefined" if (not defined $ptr[$i]);
    156162        pb_log(2,"Found parameter $params[$i] with value $ptr[$i]\n");
    157163    }
    158     $ENV{'PBPROJ'} = $proj;
    159164    return(@ptr);
    160165}
Note: See TracChangeset for help on using the changeset viewer.