Skip to content

Commit

Permalink
Update dmgtool.py to support installing toplevel pkg files
Browse files Browse the repository at this point in the history
  • Loading branch information
liyanage committed Dec 14, 2016
1 parent b035a99 commit 364cc23
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions dmgtool.py
Expand Up @@ -222,6 +222,22 @@ def process_image(self, image):
subprocess.call(cmd)


class SubcommandInstallPackage(ImageMountingSubcommand):
"""
Mount a DMG and install one or more toplevel .pkg files
"""

def process_image(self, image):
packages = glob.glob('{}/*.pkg'.format(image.mount_point()))
if not packages:
return

for package_path in packages:
cmd = ['/usr/sbin/installer', '-pkg', package_path, '-target', '/']
process = subprocess.Popen(cmd)
process.communicate()


class SubcommandUnpackMasPackage(ImageMountingSubcommand):
"""
Mount a DMG and unpack a toplevel Mac App Store package to the Desktop
Expand Down

0 comments on commit 364cc23

Please sign in to comment.