diff --git a/Library/Homebrew/cask/lib/hbc/container.rb b/Library/Homebrew/cask/lib/hbc/container.rb index cae8ea5fb8..cce04afd81 100644 --- a/Library/Homebrew/cask/lib/hbc/container.rb +++ b/Library/Homebrew/cask/lib/hbc/container.rb @@ -6,6 +6,7 @@ require "hbc/container/bzip2" require "hbc/container/cab" require "hbc/container/criteria" require "hbc/container/dmg" +require "hbc/container/self_extracting_executable" require "hbc/container/executable" require "hbc/container/generic_unar" require "hbc/container/gpg" @@ -32,6 +33,7 @@ module Hbc Ttf, Otf, Air, + SelfExtractingExecutable, Cab, Dmg, SevenZip, diff --git a/Library/Homebrew/cask/lib/hbc/container/self_extracting_executable.rb b/Library/Homebrew/cask/lib/hbc/container/self_extracting_executable.rb new file mode 100644 index 0000000000..e620c510d3 --- /dev/null +++ b/Library/Homebrew/cask/lib/hbc/container/self_extracting_executable.rb @@ -0,0 +1,15 @@ +require "hbc/container/generic_unar" + +module Hbc + class Container + class SelfExtractingExecutable < GenericUnar + def self.can_extract?(path:, magic_number:) + return false unless magic_number.match?(/\AMZ/n) + + SystemCommand.run("file", + args: [path], + print_stderr: false).stdout.include?("self-extracting") + end + end + end +end