Commit 234dacc2 authored by Daniel Helgenberger's avatar Daniel Helgenberger Committed by Ed Reel

Fixes #3205: only expand real archives (#3206)

Uses regex on File.basename(). Using File.extname() on some
files (ie, archive.tar.gz) can lead to unexpected behavior.
parent 0573e463
......@@ -444,22 +444,17 @@ def unpack (meta)
extract_dir = "#{meta[:filename]}.dir"
target_dir = nil
Dir.chdir CREW_BREW_DIR do
puts "Unpacking archive, this may take awhile..."
Dir.mkdir("#{extract_dir}") unless Dir.exist?("#{extract_dir}")
case File.extname meta[:filename]
when '.zip'
if @opt_verbose then
system "unzip", "-v", "-d", "#{extract_dir}", meta[:filename]
else
system "unzip", "-qq", "-d", "#{extract_dir}", meta[:filename]
end
else
if @opt_verbose then
system "tar", "xvf", meta[:filename], "-C", "#{extract_dir}"
else
system "tar", "xf", meta[:filename], "-C", "#{extract_dir}"
end
end
case File.basename meta[:filename]
when /\.zip$/i
puts "Unpacking archive using 'unzip', this may take awhile..."
_verbopt = @opt_verbose ? 'v' : 'qq'
system "unzip", _verbopt, "-d", "#{extract_dir}", meta[:filename]
when /\.(tar(\.(gz|bz2|xz))?|tgz|tbz)$/i
puts "Unpacking archive using 'tar', this may take awhile..."
_verbopt = @opt_verbose ? 'v' : ''
system "tar", "x#{_verbopt}f", meta[:filename], "-C", "#{extract_dir}"
end
if meta[:source] == true
# Check the number of directories in the archive
entries = Dir["#{extract_dir}/*"]
......
# Defines common constants used in different parts of crew
CREW_VERSION = '1.2.1'
CREW_VERSION = '1.2.2'
ARCH = `uname -m`.strip
ARCH_LIB = if ARCH == 'x86_64' then 'lib64' else 'lib' end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment