Created
April 9, 2013 01:42
-
-
Save cdenneen/5342248 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open(cached_source) do |dmg| | |
xml_str = hdiutil "mount", "-plist", "-nobrowse", "-readonly", "-mountrandom", "/tmp", dmg.path | |
ptable = Plist::parse_xml xml_str | |
# JJM Filter out all mount-paths into a single array, discard the rest. | |
mounts = ptable['system-entities'].collect { |entity| | |
entity['mount-point'] | |
}.select { |mountloc|; mountloc } | |
begin | |
mounts.each do |fspath| | |
Dir.entries(fspath).select { |f| | |
f =~ /\.app$/i | |
}.each do |pkg| | |
installapp("#{fspath}/#{pkg}", name, source) | |
end | |
end | |
ensure | |
hdiutil "eject", mounts[0] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment