Commit 22c3e7ed authored by Mike Hibler's avatar Mike Hibler
Browse files

Create .sha1 file in the same format as before!

Also, add undocumented -F option to quickly fix any broken hash files
(i.e., by reading hash value from the DB and not recomputing it).
parent 5db4bc14
......@@ -59,7 +59,7 @@ sub usage()
" default is 'all'\n");
exit(-1);
}
my $optlist = "dfnupqRaP:UH:V:";
my $optlist = "dfnupqRaP:UH:V:F";
my $debug = 0;
my $showinfo = 0;
my $update = 0;
......@@ -165,6 +165,11 @@ if (defined($options{"V"})) {
}
@images = @ARGV;
my $fixit = 0;
if (defined($options{"F"})) {
$fixit = 1;
}
my ($user,$user_uid);
if ($UID) {
$user = User->ThisUser();
......@@ -242,6 +247,12 @@ sub doimage($)
$stamp = 0
if (!defined($stamp));
if ($fixit) {
print "$pidimage: fixing hash file\n";
makehashfile($path, $hash);
return 0;
}
if ($showinfo) {
print "$pidimage: path: $path\n";
print "$pidimage: mtime: $stamp\n";
......@@ -486,7 +497,8 @@ sub makehashfile($$)
unlink($hashfile);
if (open(HASH, ">$hashfile")) {
print HASH $hash;
# XXX recreate the sha1 output format for compatibility
print HASH "SHA1 ($imagepath) = $hash\n";
close($hashfile);
system("touch -r $imagepath $hashfile");
}
......
Supports Markdown
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