From ecd98c00301256f358a765475a128b4aa2ff77f1 Mon Sep 17 00:00:00 2001 From: Ilia Rostovtsev Date: Thu, 9 Jun 2016 14:41:58 +0400 Subject: [PATCH] Adding ability to extract `.rpm` and `.deb` files in case dependencies are installed --- filemin/extract.cgi | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/filemin/extract.cgi b/filemin/extract.cgi index 00017631d..a6cb6bc3f 100755 --- a/filemin/extract.cgi +++ b/filemin/extract.cgi @@ -35,4 +35,16 @@ elsif ( index( $archive_type, "/x-rar" ) != -1 ) { &backquote_logged( "unrar x -r -y " . quotemeta("$cwd/$in{'file'}") . " " . quotemeta($cwd) ); &redirect("index.cgi?path=$path"); } +elsif ( index( $archive_type, "/x-rpm" ) != -1 || index( $archive_type, "/x-deb" ) != -1 ) { + my $dir = fileparse( "$cwd/$name", qr/\.[^.]*/ ); + my $path = quotemeta("$cwd/$dir"); + &backquote_logged("mkdir $path"); + if ( index( $archive_type, "/x-rpm" ) != -1 ) { + &backquote_logged( + "(rpm2cpio " . quotemeta("$cwd/$name") . " | (cd " . $path . "; cpio -idmv))" ); + } + else { + &backquote_logged( "dpkg -x " . quotemeta("$cwd/$name") . " " . $path ); + } +}