Add flat-.pkg support to CurlDownloadStrategy
This commit is contained in:
parent
b583d0ae48
commit
4490b739d5
@ -68,6 +68,9 @@ class CurlDownloadStrategy <AbstractDownloadStrategy
|
|||||||
def stage
|
def stage
|
||||||
if @tarball_path.extname == '.jar'
|
if @tarball_path.extname == '.jar'
|
||||||
magic_bytes = nil
|
magic_bytes = nil
|
||||||
|
elsif @tarball_path.extname == '.pkg'
|
||||||
|
# Use more than 4 characters to not clash with magicbytes
|
||||||
|
magic_bytes = "____pkg"
|
||||||
else
|
else
|
||||||
# get the first four bytes
|
# get the first four bytes
|
||||||
File.open(@tarball_path) { |f| magic_bytes = f.read(4) }
|
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
|
# TODO check if it's really a tar archive
|
||||||
safe_system '/usr/bin/tar', 'xf', @tarball_path
|
safe_system '/usr/bin/tar', 'xf', @tarball_path
|
||||||
chdir
|
chdir
|
||||||
|
when '____pkg'
|
||||||
|
safe_system '/usr/sbin/pkgutil', '--expand', @tarball_path, File.basename(@url)
|
||||||
|
chdir
|
||||||
when 'Rar!'
|
when 'Rar!'
|
||||||
quiet_safe_system 'unrar', 'x', {:quiet_flag => '-inul'}, @tarball_path
|
quiet_safe_system 'unrar', 'x', {:quiet_flag => '-inul'}, @tarball_path
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user