def METHOD_NAME(
    dmgfile: Path,
    destdir: Path,
    dmg_tool: Path = None,
    hfs_tool: Path = None,
):
    if is_linux:
        with mozfile.TemporaryDirectory() as tmpdir:
            hfs_file = os.path.join(tmpdir, "firefox.hfs")
            subprocess.check_call(
                [dmg_tool, "extract", dmgfile, hfs_file],
                # dmg is seriously chatty
                stdout=subprocess.DEVNULL,
            )
            subprocess.check_call([hfs_tool, hfs_file, "extractall", "/", destdir])
    else:
        # TODO: find better way to resolve topsrcdir (checkout directory)
        topsrcdir = Path(__file__).parent.parent.parent.parent.resolve()
        unpack_diskimage = topsrcdir / "build/package/mac_osx/unpack-diskimage"
        unpack_mountpoint = Path("/tmp/app-unpack")
        subprocess.check_call([unpack_diskimage, dmgfile, unpack_mountpoint, destdir])