HDIUtil::DMG
The installer DMG for OS X Lion and later. It contains a BaseSystem.dmg, which is used to install the OS X Recovery.
Export to a new DMG.
options - The Dictionary of the export options
# File lib/iesd/InstallESD/InstallESD.dmg.rb, line 18 def export options case options[:type] when :BaseSystem options = { :hdiutil => { :resize => { :grow => 0, } } }.merge(options) options[:hdiutil][:resize][:grow] += ( `/usr/bin/env hdiutil resize -limits #{@url.shellescape}`.chomp.split.map { |s| s.to_i } ).first show { |installesd| IESD::DMG::BaseSystem.new(File.join(installesd, "BaseSystem.dmg")).export(options) { |basesystem| installesd_packages = File.join installesd, PACKAGES basesystem_packages = File.join basesystem, IESD::DMG::BaseSystem::PACKAGES oh1 "Copying #{installesd_packages}" system("/usr/bin/env", "rm", basesystem_packages) system("/usr/bin/env", "ditto", installesd_packages, basesystem_packages) puts "Copied: #{basesystem_packages}" installesd_mach_kernel = File.join installesd, "mach_kernel" basesystem_mach_kernel = File.join basesystem, "mach_kernel" if File.exist? installesd_mach_kernel oh1 "Copying #{installesd_mach_kernel}" system("/usr/bin/env", "ditto", installesd_mach_kernel, basesystem_mach_kernel) system("/usr/bin/env", "chflags", "hidden", basesystem_mach_kernel) puts "Copied: #{basesystem_mach_kernel}" end } } when :InstallESD, nil Dir.mktmpdir { |tmp| HDIUtil.write(@url, (tmpfile = File.join(tmp, File.basename(@url))), options[:hdiutil]) { |installesd| options[:extensions][:up_to_date] = (options[:extensions][:uninstall].empty? and options[:extensions][:install].empty?) options[:mach_kernel] = File.exist? File.join(installesd, "mach_kernel") if options[:mach_kernel].nil? yield installesd if block_given? pre_update_extension installesd, options basesystem_options = options.clone basesystem_options[:input] = basesystem_options[:output] = File.join(installesd, "BaseSystem.dmg") basesystem_flags = `/usr/bin/env ls -lO #{basesystem_options[:input].shellescape}`.split[4] IESD::DMG::InstallESD::BaseSystem.new(File.join(basesystem_options[:input])).export(basesystem_options) { |basesystem| installesd_mach_kernel = File.join installesd, "mach_kernel" basesystem_mach_kernel = File.join basesystem, "mach_kernel" if File.exist? installesd_mach_kernel oh1 "Copying #{installesd_mach_kernel}" system("/usr/bin/env", "ditto", installesd_mach_kernel, basesystem_mach_kernel) system("/usr/bin/env", "chflags", "hidden", basesystem_mach_kernel) puts "Copied: #{basesystem_mach_kernel}" end } system("/usr/bin/env", "chflags", basesystem_flags, basesystem_options[:output]) unless basesystem_flags == "-" if File.exist? (kextcache = File.join(installesd, "kernelcache")) IESD::DMG::InstallESD::BaseSystem.new(File.join(basesystem_options[:output])).show { |basesystem| oh1 "Updating Kextcache" system("/usr/bin/env", "ditto", File.join(basesystem, *KextCache::KERNELCACHE), kextcache) system("/usr/bin/env", "chflags", "hidden", kextcache) puts "Updated: #{kextcache}" } end post_update_extension installesd, options if options[:interactive] oh1 "Starting Interactive Shell" puts "Environment: InstallESD" HDIUtil.shell installesd end } system("/usr/bin/env", "mv", tmpfile, options[:output]) } else raise "invalid output type" end end
Generated with the Darkfish Rdoc Generator 2.