module PKGUtil
/usr/sbin/pkgutil
developer.apple.com/library/mac/documentation/Darwin/Reference/Manpages/man1/pkgutil.1.html
Public Class Methods
read(input) { |tmp| ... }
click to toggle source
Perform read-only actions on the input package.
If a block is given the block will be yielded with the path of the package expanded directory, otherwise a shell will be open.
input - The String path to the input package.
# File lib/iesd/utility/pkgutil.rb, line 14 def self.read input Dir.mktmpdir { |tmp| tmp = File.join tmp, File.basename(input) expand input, tmp if block_given? yield tmp else shell tmp end } end
write(input, output = input) { |tmp| ... }
click to toggle source
Perform read-write actions on the input package and export as the output package.
If a block is given the block will be yielded with the path of the package expanded directory, otherwise a shell will be open.
input - The String path to the input package. output - The String path to the output package.
# File lib/iesd/utility/pkgutil.rb, line 32 def self.write input, output = input Dir.mktmpdir { |tmp| tmp = File.join tmp, File.basename(input) expand input, tmp if block_given? yield tmp else shell tmp end flatten tmp, output } end
Private Class Methods
expand(pkg, dir)
click to toggle source
flatten(dir, pkg)
click to toggle source
shell(dir)
click to toggle source
Open a shell in the directory.
dir - The String path to the directory.
# File lib/iesd/utility/pkgutil.rb, line 70 def self.shell dir Dir.chdir(dir) { ohai ENV['SHELL'] Kernel.system ENV, ENV['SHELL'] } end