Sha256: 1d898134d20a64be8b9eae1099695a1c40c58f563abb5846a8ca83ad3f4e3e1f
Contents?: true
Size: 1.01 KB
Versions: 8
Compression:
Stored size: 1.01 KB
Contents
class Puppet::ModuleTool::Tar::Mini def unpack(sourcefile, destdir, _) Zlib::GzipReader.open(sourcefile) do |reader| Archive::Tar::Minitar.unpack(reader, destdir) do |action, name, stats| case action when :file_done File.chmod(0444, "#{destdir}/#{name}") when :dir, :file_start validate_entry(destdir, name) Puppet.debug("extracting #{destdir}/#{name}") end end end end def pack(sourcedir, destfile) Zlib::GzipWriter.open(destfile) do |writer| Archive::Tar::Minitar.pack(sourcedir, writer) end end private def validate_entry(destdir, path) if Pathname.new(path).absolute? raise Puppet::ModuleTool::Errors::InvalidPathInPackageError, :entry_path => path, :directory => destdir end path = File.expand_path File.join(destdir, path) if path !~ /\A#{Regexp.escape destdir}/ raise Puppet::ModuleTool::Errors::InvalidPathInPackageError, :entry_path => path, :directory => destdir end end end
Version data entries
8 entries across 8 versions & 1 rubygems