sub computeSHA1 () { # Passed a file path, opens the file and calculates the SHA1 value my $srcfile = shift; print "DEBUG: computeSHA1: arrived\n" if ($debug); my $sha1post = Digest::SHA1->new; open my $filehandle, $srcfile or &usage("computeSHA: Failed to open " . $srcfile . ": " . $!, 2); $sha1post->addfile($filehandle); print "DEBUG: downloadSHA1: Calculating SHA1 for $srcfile\n" if ($debug); close $filehandle; return $sha1post->hexdigest; } sub downloadSHA1 () { # Passed a URL for a file, looks for the SHA1 file and returns the value my $url = shift; print "DEBUG: downloadSHA1: arrived\n" if ($debug); my $SHAurl = $url . ".sha1"; my $browser = LWP::UserAgent->new; # Get the SHA1 value from $SHAurl my $SHAcall = $browser->get($SHAurl); print "DEBUG: downloadSHA1: Getting SHA1 from $SHAurl\n" if ($debug); &usage("downloadSHA1: Could not fetch SHA1 at " . $SHAurl, 5) unless $SHAcall->is_success; return $SHAcall->content; } #### C:\TaskServer>c:\software\fciv\fciv -sha1 gbmiportal-4.0.0.791577-SNAPSHOT.ear // // File Checksum Integrity Verifier version 2.05. // 0ad3530689d273b472d4b20835476b756c6361af gbmiportal-4.0.0.791577-snapshot.ear C:\TaskServer>perl -MDigest::SHA1=sha1_hex -le "print sha1_hex <>" gbmiportal-4.0.0.791577-SNAPSHOT.ear 8d829b7cdf254f01b1e217f3dfd28c2539891f8f