Commit 4095466e authored by Andoni Morales Alastruey's avatar Andoni Morales Alastruey Committed by Matthew Waters
Browse files

Add support to extract .dmg volumes

Part-of: <!661>
parent b3b588a6
......@@ -337,6 +337,13 @@ async def unpack(filepath, output_dir, logfile=None):
elif filepath.endswith('.zip'):
zf = zipfile.ZipFile(filepath, "r")
zf.extractall(path=output_dir)
elif filepath.endswith('.dmg'):
vol_name = '/Volumes/' + os.path.splitext(os.path.split(filepath)[1])[0]
if not os.path.exists(output_dir):
os.makedirs(output_dir)
call(['hdiutil', 'attach', filepath])
call(['cp', '-r', vol_name, output_dir])
call(['hdiutil', 'detach', vol_name])
else:
raise FatalError("Unknown tarball format %s" % filepath)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment