aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorAdam Vandenberg2010-06-28 21:28:01 -0700
committerAdam Vandenberg2010-06-30 10:14:33 -0700
commitec6f826f2df55ea28e0fb42f8f642baa74b26292 (patch)
tree94c7bb12bcc95f1f6848f9a7363b58329d107beb /Library
parent6b371636e9c9ee2d163595af27d3f891f0e8b171 (diff)
downloadhomebrew-ec6f826f2df55ea28e0fb42f8f642baa74b26292.tar.bz2
Add flat-.pkg support to CurlDownloadStrategy
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/download_strategy.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb
index 2fb7d7c97..6176e4970 100644
--- a/Library/Homebrew/download_strategy.rb
+++ b/Library/Homebrew/download_strategy.rb
@@ -68,6 +68,9 @@ class CurlDownloadStrategy <AbstractDownloadStrategy
def stage
if @tarball_path.extname == '.jar'
magic_bytes = nil
+ elsif @tarball_path.extname == '.pkg'
+ # Use more than 4 characters to not clash with magicbytes
+ magic_bytes = "____pkg"
else
# get the first four bytes
File.open(@tarball_path) { |f| magic_bytes = f.read(4) }
@@ -82,6 +85,9 @@ class CurlDownloadStrategy <AbstractDownloadStrategy
# TODO check if it's really a tar archive
safe_system '/usr/bin/tar', 'xf', @tarball_path
chdir
+ when '____pkg'
+ safe_system '/usr/sbin/pkgutil', '--expand', @tarball_path, File.basename(@url)
+ chdir
when 'Rar!'
quiet_safe_system 'unrar', 'x', {:quiet_flag => '-inul'}, @tarball_path
else