374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
|
# File 'lib/xcode/install.rb', line 374
def prepare_package
puts 'Mounting DMG'
mount_location = Installer.new.mount(dmg_path)
puts 'Expanding pkg'
expanded_pkg_path = CACHE_DIR + identifier
FileUtils.rm_rf(expanded_pkg_path)
`pkgutil --expand #{mount_location}/*.pkg #{expanded_pkg_path}`
puts "Expanded pkg into #{expanded_pkg_path}"
puts 'Unmounting DMG'
`umount #{mount_location}`
puts 'Setting package installation location'
package_info_path = expanded_pkg_path + 'PackageInfo'
package_info_contents = File.read(package_info_path)
File.open(package_info_path, 'w') do |f|
f << package_info_contents.sub('pkg-info', %(pkg-info install-location="#{@install_prefix}"))
end
puts 'Rebuilding package'
`pkgutil --flatten #{expanded_pkg_path} #{pkg_path}`
FileUtils.rm_rf(expanded_pkg_path)
end
|