From 82482f4787e61bfb5a9dd0551b8941aef25b9ff0 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Mon, 16 Jul 2018 09:54:37 +0200 Subject: [PATCH] Add support for self-extracting `.exe` archives. --- Library/Homebrew/cask/lib/hbc/container.rb | 2 ++ .../hbc/container/self_extracting_executable.rb | 15 +++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 Library/Homebrew/cask/lib/hbc/container/self_extracting_executable.rb 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