Sha256: 119ba949415afa22475057193fe305ef7e43be240694c9d64389cf68afa847fe

Contents?: true

Size: 723 Bytes

Versions: 20

Compression:

Stored size: 723 Bytes

Contents

# frozen_string_literal: true
require 'shellwords'

class Puppet::ModuleTool::Tar::Gnu
  def unpack(sourcefile, destdir, owner)
    sourcefile = File.expand_path(sourcefile)
    destdir = File.expand_path(destdir)

    Dir.chdir(destdir) do
      Puppet::Util::Execution.execute("gzip -dc #{Shellwords.shellescape(sourcefile)} | tar xof -")
      Puppet::Util::Execution.execute("find . -type d -exec chmod 755 {} +")
      Puppet::Util::Execution.execute("find . -type f -exec chmod u+rw,g+r,a-st {} +")
      Puppet::Util::Execution.execute("chown -R #{owner} .")
    end
  end

  def pack(sourcedir, destfile)
    Puppet::Util::Execution.execute("tar cf - #{sourcedir} | gzip -c > #{File.basename(destfile)}")
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
puppet-8.3.0 lib/puppet/module_tool/tar/gnu.rb
puppet-8.3.0-x86-mingw32 lib/puppet/module_tool/tar/gnu.rb
puppet-8.3.0-x64-mingw32 lib/puppet/module_tool/tar/gnu.rb
puppet-8.3.0-universal-darwin lib/puppet/module_tool/tar/gnu.rb
puppet-8.3.1 lib/puppet/module_tool/tar/gnu.rb
puppet-8.3.1-x86-mingw32 lib/puppet/module_tool/tar/gnu.rb
puppet-8.3.1-x64-mingw32 lib/puppet/module_tool/tar/gnu.rb
puppet-8.3.1-universal-darwin lib/puppet/module_tool/tar/gnu.rb
puppet-8.2.0 lib/puppet/module_tool/tar/gnu.rb
puppet-8.2.0-x86-mingw32 lib/puppet/module_tool/tar/gnu.rb
puppet-8.2.0-x64-mingw32 lib/puppet/module_tool/tar/gnu.rb
puppet-8.2.0-universal-darwin lib/puppet/module_tool/tar/gnu.rb
puppet-8.1.0 lib/puppet/module_tool/tar/gnu.rb
puppet-8.1.0-x86-mingw32 lib/puppet/module_tool/tar/gnu.rb
puppet-8.1.0-x64-mingw32 lib/puppet/module_tool/tar/gnu.rb
puppet-8.1.0-universal-darwin lib/puppet/module_tool/tar/gnu.rb
puppet-8.0.1 lib/puppet/module_tool/tar/gnu.rb
puppet-8.0.1-x86-mingw32 lib/puppet/module_tool/tar/gnu.rb
puppet-8.0.1-x64-mingw32 lib/puppet/module_tool/tar/gnu.rb
puppet-8.0.1-universal-darwin lib/puppet/module_tool/tar/gnu.rb