diff -u -r mesa/bin/install_megadrivers.py mesa-patched/bin/install_megadrivers.py --- mesa/bin/install_megadrivers.py 2018-03-27 19:35:14.000000000 +0200 +++ mesa-patched/bin/install_megadrivers.py 2018-03-28 10:27:15.898280592 +0200 @@ -50,18 +50,13 @@ print('installing {} to {}'.format(args.megadriver, driver)) os.link(master, driver) - try: - ret = os.getcwd() - os.chdir(to) - - name, ext = os.path.splitext(each) - while ext != '.so': - if os.path.exists(name): - os.unlink(name) - os.symlink(driver, name) - name, ext = os.path.splitext(name) - finally: - os.chdir(ret) + name, ext = os.path.splitext(each) + while ext != '.so': + symlink = os.path.join(to, name) + if os.path.exists(symlink): + os.unlink(symlink) + os.symlink(each, symlink) + name, ext = os.path.splitext(name) os.unlink(master)