Merge pull request #7 from Debdut/master

Fixed darwin.iso download errors
This commit is contained in:
Paolo 2021-12-13 19:38:42 +01:00 committed by GitHub
commit 3fa8d0b87f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 62 additions and 88 deletions

33
README.md Normal file
View File

@ -0,0 +1,33 @@
# Unlocker
Unlocker for Mac OS in VMware Workstation
This project fixes the erros of [paolo-projects/unlocker](https://github.com/paolo-projects/unlocker)
Works on
- Workstation 11-16 on Windows and Linux
- Workstation Player 7/12/14/15/16 on Windows and Linux
## Install
Linux
```sh
$ sudo ./lnx-install.sh
```
Windows
Run `win-install.cmd` file
## Prerequisites
python2 and python3
## Note
Always uninstall the previous version of the Unlocker before using a new version. Failure to do this could render VMware unusable.
## Acknowledgement
Thanks to [paolo-projects/unlocker](https://github.com/paolo-projects/unlocker) and it's contributors

View File

@ -31,6 +31,8 @@ import tarfile
import zipfile import zipfile
import time import time
ARCH = 'x86'
try: try:
# For Python 3.0 and later # For Python 3.0 and later
# noinspection PyCompatibility # noinspection PyCompatibility
@ -125,21 +127,9 @@ def main():
lastVersion = parser.HTMLDATA[-1] lastVersion = parser.HTMLDATA[-1]
urlpost15 = url + lastVersion + '/packages/com.vmware.fusion.tools.darwin.zip.tar'
urlpre15 = url + lastVersion + '/packages/com.vmware.fusion.tools.darwinPre15.zip.tar'
parser.clean() parser.clean()
# Download the darwin.iso tgz file urlcoretar = url + lastVersion + '/' + ARCH + '/core/com.vmware.fusion.zip.tar'
print('Retrieving Darwin tools from: ' + urlpost15)
try:
# Try to get tools from packages folder
urlretrieve(urlpost15, convertpath(dest + '/tools/com.vmware.fusion.tools.darwin.zip.tar'))
except:
# No tools found, get em from the core tar
print('Tools aren\'t here... Be patient while I download and' +
' give a look into the core.vmware.fusion.tar file')
urlcoretar = url + lastVersion + '/core/com.vmware.fusion.zip.tar'
# Get the main core file # Get the main core file
try: try:
@ -148,8 +138,6 @@ def main():
print('Couldn\'t find tools') print('Couldn\'t find tools')
return return
print()
print('Extracting com.vmware.fusion.zip.tar...') print('Extracting com.vmware.fusion.zip.tar...')
tar = tarfile.open(convertpath(dest + '/tools/com.vmware.fusion.zip.tar'), 'r') tar = tarfile.open(convertpath(dest + '/tools/com.vmware.fusion.zip.tar'), 'r')
tar.extract('com.vmware.fusion.zip', path=convertpath(dest + '/tools/')) tar.extract('com.vmware.fusion.zip', path=convertpath(dest + '/tools/'))
@ -173,53 +161,6 @@ def main():
print('Tools retrieved successfully') print('Tools retrieved successfully')
return return
# Tools have been found, go with the normal way
# Extract the tar to zip
tar = tarfile.open(convertpath(dest + '/tools/com.vmware.fusion.tools.darwin.zip.tar'), 'r')
tar.extract('com.vmware.fusion.tools.darwin.zip', path=convertpath(dest + '/tools/'))
tar.close()
# Extract the iso and sig files from zip
cdszip = zipfile.ZipFile(convertpath(dest + '/tools/com.vmware.fusion.tools.darwin.zip'), 'r')
cdszip.extract('payload/darwin.iso', path=convertpath(dest + '/tools/'))
cdszip.extract('payload/darwin.iso.sig', path=convertpath(dest + '/tools/'))
cdszip.close()
# Move the iso and sig files to tools folder
shutil.move(convertpath(dest + '/tools/payload/darwin.iso'), convertpath(dest + '/tools/darwin.iso'))
shutil.move(convertpath(dest + '/tools/payload/darwin.iso.sig'), convertpath(dest + '/tools/darwin.iso.sig'))
# Cleanup working files and folders
shutil.rmtree(convertpath(dest + '/tools/payload'), True)
os.remove(convertpath(dest + '/tools/com.vmware.fusion.tools.darwin.zip.tar'))
os.remove(convertpath(dest + '/tools/com.vmware.fusion.tools.darwin.zip'))
# Download the darwinPre15.iso tgz file
print('Retrieving DarwinPre15 tools from: ' + urlpre15)
urlretrieve(urlpre15, convertpath(dest + '/tools/com.vmware.fusion.tools.darwinPre15.zip.tar'))
# Extract the tar to zip
tar = tarfile.open(convertpath(dest + '/tools/com.vmware.fusion.tools.darwinPre15.zip.tar'), 'r')
tar.extract('com.vmware.fusion.tools.darwinPre15.zip', path=convertpath(dest + '/tools/'))
tar.close()
# Extract the iso and sig files from zip
cdszip = zipfile.ZipFile(convertpath(dest + '/tools/com.vmware.fusion.tools.darwinPre15.zip'), 'r')
cdszip.extract('payload/darwinPre15.iso', path=convertpath(dest + '/tools/'))
cdszip.extract('payload/darwinPre15.iso.sig', path=convertpath(dest + '/tools/'))
cdszip.close()
# Move the iso and sig files to tools folder
shutil.move(convertpath(dest + '/tools/payload/darwinPre15.iso'),
convertpath(dest + '/tools/darwinPre15.iso'))
shutil.move(convertpath(dest + '/tools/payload/darwinPre15.iso.sig'),
convertpath(dest + '/tools/darwinPre15.iso.sig'))
# Cleanup working files and folders
shutil.rmtree(convertpath(dest + '/tools/payload'), True)
os.remove(convertpath(dest + '/tools/com.vmware.fusion.tools.darwinPre15.zip.tar'))
os.remove(convertpath(dest + '/tools/com.vmware.fusion.tools.darwinPre15.zip'))
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -30,7 +30,7 @@ echo Patching...
python2 ./unlocker.py python2 ./unlocker.py
echo Getting VMware Tools... echo Getting VMware Tools...
python gettools.py python3 gettools.py
cp ./tools/darwin*.* /usr/lib/vmware/isoimages/ cp ./tools/darwin*.* /usr/lib/vmware/isoimages/
echo Finished! echo Finished!

View File

@ -48,7 +48,7 @@ unlocker.exe
echo. echo.
echo Getting VMware Tools... echo Getting VMware Tools...
gettools.exe python gettools.py
xcopy /F /Y .\tools\darwin*.* "%InstallPath%" xcopy /F /Y .\tools\darwin*.* "%InstallPath%"
echo. echo.