@@ -32,6 +32,7 @@ use File::Copy;
use File::Basename;
use IO::Handle;
use Carp;
+use Digest::SHA;
BEGIN {
use Exporter ();
@@ -132,6 +133,7 @@ BEGIN {
guest_editconfig_nocd
host_install_postboot_complete
target_core_dump_setup
+ sha256file
);
%EXPORT_TAGS = ( );
@@ -2769,4 +2771,15 @@ sub target_https_mitm_proxy_setup ($) {
target_cmd_root($ho, 'update-ca-certificates', 300);
}
+sub sha256file ($;$) {
+ my ($file,$truncate) = @_;
+ my $sha = Digest::SHA->new(256);
+ my $digest;
+
+ $sha->addfile($file);
+ $digest = $sha->hexdigest;
+
+ return $truncate ? substr($digest, 0, $truncate) : $digest;
+}
+
1;
The helper is going to be used to calculate the sha256 of the FreeBSD installer images. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> --- Changes since v3: - New in this version. --- Osstest/TestSupport.pm | 13 +++++++++++++ 1 file changed, 13 insertions(+)