- Timestamp:
- May 5, 2013, 4:48:19 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/mr/lib/MondoRescue/Base.pm
r3108 r3109 61 61 my $msg = shift || ""; 62 62 63 pb_log_init($pbdebug); 64 63 65 if (defined $msg) { 64 66 pb_log($pbdebug,$msg); … … 66 68 67 69 70 my $pbproj; 68 71 # Get the various location determined at installation time 69 my ($etcdir,$pbproj) = mr_dynconf_init();72 ($mr->{'confdir'},$pbproj) = mr_dynconf_init(); 70 73 71 74 # Temp dir … … 74 77 # First use the main configuration file 75 78 pb_conf_init($pbproj); 79 $ENV{'PBPROJ'} = $pbproj; 76 80 # 77 81 # Conf files Management 78 # the $ etcdir/mondorescue.conf.dist is delivered as part of the project and82 # the $mr->{'confdir'}/mondorescue.conf.dist is delivered as part of the project and 79 83 # its checksum is verified as we need good default values that we can trust 80 84 # 81 open(MD5,"$ etcdir/$pbproj.conf.dist.md5") || die "Unable to read mandatory $etcdir/$pbproj.conf.dist.md5: $!";85 open(MD5,"$mr->{'confdir'}/$pbproj.conf.dist.md5") || die "Unable to read mandatory $mr->{'confdir'}/$pbproj.conf.dist.md5: $!"; 82 86 my $omd5 = <MD5>; 87 close(MD5); 83 88 chomp($omd5); 84 close(MD5); 85 open(CONF,"$etcdir/$pbproj.conf.dist") || die "Unable to read mandatory $etcdir/$pbproj.conf.dist: $!";86 my $md5 = Digest::MD5->new;89 # remove file name 90 $omd5 =~ s/ .*//; 91 open(CONF,"$mr->{'confdir'}/$pbproj.conf.dist") || die "Unable to read mandatory $mr->{'confdir'}/$pbproj.conf.dist: $!"; 87 92 binmode(CONF); 88 $md5->addfile(CONF);89 my $digest = $md5->hexdigest;90 die "Invalid MD5 sum found for $etcdir/$pbproj.conf.dist: $digest" if ($omd5 ne $digest);93 my $md5 = Digest::MD5->new->addfile(*CONF)->hexdigest; 94 chomp($md5); 95 die "Invalid MD5 found sum for $mr->{'confdir'}/$pbproj.conf.dist: *$md5* instead of *$omd5*" if ($omd5 ne $md5); 91 96 close(CONF); 92 97 93 pb_conf_add("$etcdir/$pbproj.conf.dist"); 98 pb_conf_add("$mr->{'confdir'}/$pbproj.conf.dist"); 99 pb_conf_add("$mr->{'confdir'}/$pbproj.conf") if (-f "$mr->{'confdir'}/$pbproj.conf"); 100 101 my @date = pb_get_date(); 102 $mr->{'start_date'} = strftime("%Y-%m-%d %H:%M:%S", @date); 94 103 } 95 104 … … 113 122 close($mr->{'logdesc'}); 114 123 } 115 die "ERROR returned\n" if ($code <0);124 die "ERROR returned\n" if ($code lt 0); 116 125 exit($code); 117 126 }
Note:
See TracChangeset
for help on using the changeset viewer.