Fix extracting .pax archives.

This commit is contained in:
Markus Reiter 2018-09-11 19:21:18 +02:00
parent 1fe8cf7079
commit 06549c751b
2 changed files with 27 additions and 1 deletions

View File

@ -30,6 +30,7 @@ module UnpackStrategy
def self.strategies
@strategies ||= [
Tar, # needs to be before Bzip2/Gzip/Xz/Lzma
Pax,
Gzip,
Lzma,
Xz,
@ -78,7 +79,7 @@ module UnpackStrategy
end
def self.from_extension(extension)
strategies.sort_by { |s| s.extensions.map(&:length).max(0) }
strategies.sort_by { |s| s.extensions.map(&:length).max || 0 }
.reverse
.find { |s| s.extensions.any? { |ext| extension.end_with?(ext) } }
end
@ -165,6 +166,7 @@ require "unpack_strategy/mercurial"
require "unpack_strategy/microsoft_office_xml"
require "unpack_strategy/otf"
require "unpack_strategy/p7zip"
require "unpack_strategy/pax"
require "unpack_strategy/pkg"
require "unpack_strategy/rar"
require "unpack_strategy/self_extracting_executable"

View File

@ -0,0 +1,24 @@
module UnpackStrategy
class Pax
include UnpackStrategy
using Magic
def self.extensions
[".pax"]
end
def self.can_extract?(_path)
false
end
private
def extract_to_dir(unpack_dir, basename:, verbose:)
system_command! "pax",
args: ["-rf", path],
chdir: unpack_dir,
verbose: verbose
end
end
end