File mc-extfs-helpers-deb.patch of Package mc

---
 src/vfs/extfs/helpers/deb.in |   23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

--- a/src/vfs/extfs/helpers/deb.in
+++ b/src/vfs/extfs/helpers/deb.in
@@ -179,6 +179,15 @@ sub mcdebfs_run
 	}
 }
 
+sub _which
+{
+    my $app = shift;
+    foreach my $dir (split/:/, $ENV{'PATH'}) {
+        return "$dir/$app" if -x "$dir/$app";
+    }
+    return undef;
+}
+
 $pressinstall=<<EOInstall;
 
                               WARNING
@@ -195,6 +204,20 @@ EOInstall
 
 umask 077;
 
+
+# check for required dpkg utilities
+my $dpkg_deb = _which('dpkg-deb');
+my $dpkg = _which('dpkg');
+
+# use uar extfs-heper if not exists
+if (not defined $dpkg_deb or not defined $dpkg)
+{
+    if ($0 =~ /^(.*)\/deb$/) {
+        my $uar = "$1/uar" ;
+        exec $uar, @ARGV;
+    }
+}
+
 if($ARGV[0] eq "list") { shift; &mcdebfs_list(@ARGV); exit 0; }
 elsif($ARGV[0] eq "copyout") { shift; &mcdebfs_copyout(@ARGV); exit 0; }
 elsif($ARGV[0] eq "run") { shift; &mcdebfs_run(@ARGV); exit 0; }
openSUSE Build Service is sponsored by