[pve-devel] [PATCH V2 common 1/1] fix #4849: download file from url: add opt parameter for a decompression command

Philipp Hufnagl p.hufnagl at proxmox.com
Thu Jul 27 17:28:15 CEST 2023


Signed-off-by: Philipp Hufnagl <p.hufnagl at proxmox.com>
---
 src/PVE/Tools.pm | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/PVE/Tools.pm b/src/PVE/Tools.pm
index 9ffac12..d9869e8 100644
--- a/src/PVE/Tools.pm
+++ b/src/PVE/Tools.pm
@@ -2059,6 +2059,15 @@ sub download_file_from_url {
     }
 
     print "download of '$url' to '$dest' finished\n";
+
+    if ($opts->{decompression_command}) {
+         my $cmd = join(' ', $opts->{decompression_command}->@*, $dest);
+        eval{run_command($cmd);};
+        my $rerr = $@;
+        unlink $dest;
+        die "$rerr\n" if $rerr;
+        print "decompressed $dest\n";
+    }
 }
 
 sub get_file_hash {
-- 
2.39.2






More information about the pve-devel mailing list