Skip to content

Instantly share code, notes, and snippets.

@cdenneen
Created April 9, 2013 01:42
Show Gist options
  • Save cdenneen/5342248 to your computer and use it in GitHub Desktop.
Save cdenneen/5342248 to your computer and use it in GitHub Desktop.
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