# File lib/puppet/provider/package/pkgdmg.rb, line 70
 70:     def self.installpkgdmg(source, name)
 71:         unless source =~ /\.dmg$/i
 72:             raise Puppet::Error.new("Mac OS X PKG DMG's must specificy a source string ending in .dmg")
 73:         end
 74:         require 'open-uri'
 75:         cached_source = source
 76:         if %r{\A[A-Za-z][A-Za-z0-9+\-\.]*://} =~ cached_source
 77:             cached_source = "/tmp/#{name}"
 78:             begin
 79:                 curl "-o", cached_source, "-C", "-", "-k", "-s", "--url", source
 80:                 Puppet.debug "Success: curl transfered [#{name}]"
 81:             rescue Puppet::ExecutionFailure
 82:                 Puppet.debug "curl did not transfer [#{name}].  Falling back to slower open-uri transfer methods."
 83:                 cached_source = source
 84:             end
 85:         end
 86: 
 87:         begin
 88:             File.open(cached_source) do |dmg|
 89:                 xml_str = hdiutil "mount", "-plist", "-nobrowse", "-readonly", "-noidme", "-mountrandom", "/tmp", dmg.path
 90:                 hdiutil_info = Plist::parse_xml(xml_str)
 91:                 unless hdiutil_info.has_key?("system-entities")
 92:                     raise Puppet::Error.new("No disk entities returned by mount at %s" % dmg.path)
 93:                 end
 94:                 mounts = hdiutil_info["system-entities"].collect { |entity|
 95:                     entity["mount-point"]
 96:                 }.compact
 97:                 begin
 98:                     mounts.each do |mountpoint|
 99:                         Dir.entries(mountpoint).select { |f|
100:                             f =~ /\.m{0,1}pkg$/i
101:                         }.each do |pkg|
102:                             installpkg("#{mountpoint}/#{pkg}", name, source)
103:                         end
104:                     end
105:                 ensure
106:                     mounts.each do |mountpoint|
107:                         hdiutil "eject", mountpoint
108:                     end
109:                 end
110:             end
111:         ensure
112:             # JJM Remove the file if open-uri didn't already do so.
113:             File.unlink(cached_source) if File.exist?(cached_source)
114:         end
115:     end