Class: Puppet::ModuleTool::Tar::Gnu
- Defined in:
- lib/puppet/module_tool/tar/gnu.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(command = "tar") ⇒ Gnu
constructor
A new instance of Gnu.
- #pack(sourcedir, destfile) ⇒ Object
- #unpack(sourcefile, destdir, owner) ⇒ Object
Constructor Details
#initialize(command = "tar") ⇒ Gnu
Returns a new instance of Gnu.
2 3 4 |
# File 'lib/puppet/module_tool/tar/gnu.rb', line 2 def initialize(command = "tar") @command = command end |
Instance Method Details
#pack(sourcedir, destfile) ⇒ Object
13 14 15 |
# File 'lib/puppet/module_tool/tar/gnu.rb', line 13 def pack(sourcedir, destfile) Puppet::Util::Execution.execute("tar cf - #{sourcedir} | gzip -c > #{destfile}") end |
#unpack(sourcefile, destdir, owner) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/puppet/module_tool/tar/gnu.rb', line 6 def unpack(sourcefile, destdir, owner) Puppet::Util::Execution.execute("#{@command} xzf #{sourcefile} --no-same-owner -C #{destdir}") Puppet::Util::Execution.execute("find #{destdir} -type d -exec chmod 755 {} +") Puppet::Util::Execution.execute("find #{destdir} -type f -exec chmod a-wst {} +") Puppet::Util::Execution.execute("chown -R #{owner} #{destdir}") end |