Commit 41f7c387 authored by Mike Hibler's avatar Mike Hibler

Make sure the mtimes are all set correctly on .sha1 and .sig files.

parent 77064c9e
......@@ -767,6 +767,7 @@ sub doimage($)
if ($update && !$dpath) {
$image->SetDeltaHash(undef);
}
$filehash = undef;
}
if ($dpath) {
......@@ -920,6 +921,96 @@ sub doimage($)
if (system("touch -r $path $dpath >/dev/null 2>&1")) {
print STDERR
"$pidimage: WARNING: could not set modtime of $dpath\n";
} else {
$dftime = $ftime;
}
}
}
#
# Make sure hash and signature file times match the image.
#
if ($path) {
my $hfile = $image->FullImageSHA1File();
if (-e $hfile) {
my $hftime = stat($hfile)->mtime;
if ($hftime != $ftime) {
if ($update) {
print "$pidimage: SHA1 mtime: "
if (!$quiet);
if (system("touch -r $path $hfile >/dev/null 2>&1")) {
print "[FAILED]\n"
if (!$quiet);
} else {
print "[FIXED]\n"
if (!$quiet);
}
} else {
print "$pidimage: image mtime ($ftime) != SHA1 mtime ($hftime)\n"
if (!$quiet);
}
}
}
my $sfile = $image->FullImageSigFile();
if (-e $sfile) {
my $sftime = stat($sfile)->mtime;
if ($sftime != $ftime) {
if ($update) {
print "$pidimage: SIG mtime: "
if (!$quiet);
if (system("touch -r $path $sfile >/dev/null 2>&1")) {
print "[FAILED]\n"
if (!$quiet);
} else {
print "[FIXED]\n"
if (!$quiet);
}
} else {
print "$pidimage: image mtime ($ftime) != sig mtime ($sftime)\n"
if (!$quiet);
}
}
}
}
if ($dpath) {
my $hfile = $image->DeltaImageSHA1File();
if (-e $hfile) {
my $hftime = stat($hfile)->mtime;
if ($hftime != $dftime) {
if ($update) {
print "$pidimage: delta SHA1 mtime: "
if (!$quiet);
if (system("touch -r $dpath $hfile >/dev/null 2>&1")) {
print "[FAILED]\n"
if (!$quiet);
} else {
print "[FIXED]\n"
if (!$quiet);
}
} else {
print "$pidimage: delta image mtime ($dftime) != SHA1 mtime ($hftime)\n"
if (!$quiet);
}
}
}
my $sfile = $image->DeltaImageSigFile();
if (-e $sfile) {
my $sftime = stat($sfile)->mtime;
if ($sftime != $dftime) {
if ($update) {
print "$pidimage: delta SIG mtime: "
if (!$quiet);
if (system("touch -r $dpath $sfile >/dev/null 2>&1")) {
print "[FAILED]\n"
if (!$quiet);
} else {
print "[FIXED]\n"
if (!$quiet);
}
} else {
print "$pidimage: delta image mtime ($dftime) != sig mtime ($sftime)\n"
if (!$quiet);
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment