Skip to content

Commit

Permalink
Version 3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
DrDonk committed Sep 27, 2018
1 parent 0294591 commit a3f79b0
Show file tree
Hide file tree
Showing 6 changed files with 119 additions and 13 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ build/
dist/
*.spec
*.pyc
*.tar
*.tgz
*.vmtar
*.vgz
75 changes: 75 additions & 0 deletions esxi-build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/usr/bin/env python
"""
The MIT License (MIT)
Copyright (c) 2014-2018 Dave Parsons & Sam Bingner
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the 'Software'), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
"""

import datetime
import subprocess
import sys


if sys.version_info < (2, 7):
sys.stderr.write('You need Python 2.7 or later\n')
sys.exit(1)

# TODO: Change for a new release
VERSION = '3.0.0'
FILEVER = '300'
FILENAME = 'esxi-unlocker-300.tgz'

TIMESTAMP = '{:%Y%m%d%H%M.%S}'.format(datetime.datetime.now())
TOUCH = 'touch -t ' + TIMESTAMP
GTARUNLOCKER = '/usr/local/bin/gtar czvf unlocker.tgz etc'
GTARDISTRIB = '/usr/local/bin/gtar czvf ' + FILENAME + \
' unlocker.tgz esxi-install.sh esxi-uninstall.sh esxi-smctest.sh readme.txt'


def main():

# Timestamp files for release
print('\nTimestamping files...')
subprocess.call(TOUCH + ' readme.txt', shell=True)
subprocess.call(TOUCH + ' esxi-install.sh', shell=True)
subprocess.call(TOUCH + ' esxi-uninstall.sh', shell=True)
subprocess.call(TOUCH + ' esxi-smctest.sh', shell=True)
subprocess.call(TOUCH + ' etc', shell=True)
subprocess.call(TOUCH + ' etc/rc.local.d', shell=True)
subprocess.call(TOUCH + ' etc/rc.local.d/unlocker.py', shell=True)

# Build the gzipped tar file unlocker.tgz
print('\nCreating unlocker.tgz...')
subprocess.call(GTARUNLOCKER, shell=True)
subprocess.call(TOUCH + ' unlocker.tgz', shell=True)

# Build the distribution file esxi-unlocker-VER.tgz
print('\nCreating ' + FILENAME + '...')
subprocess.call(GTARDISTRIB, shell=True)
subprocess.call(TOUCH + ' ' + FILENAME, shell=True)


if __name__ == '__main__':
if sys.platform == 'darwin':
print('ESXi-Build for macOS')
main()
else:
print('ESXi-Build only supported on macOS')
5 changes: 0 additions & 5 deletions esxi-build.sh

This file was deleted.

2 changes: 1 addition & 1 deletion bin/smctest.sh → esxi-smctest.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
grep -il \(c\)AppleComputerInc /bin/vmx*
vim-cmd hostsvc/hosthardware | grep smcPresent | cut -d ',' -f 1 | sed 's/^[ \t]*//'
grep useVmxSandbox /etc/vmware/hostd/config.xml | sed 's/^[ \t]*//'
esxcli system visorfs tardisk list | grep custom.vgz
9 changes: 6 additions & 3 deletions etc/rc.local.d/unlocker.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
0x18/24 0x30/48 48B byte Data
"""

from __future__ import print_function
import codecs
import os
import shutil
Expand Down Expand Up @@ -377,7 +376,11 @@ def main():


if __name__ == '__main__':
# Exit if "nounlocker" boot option specified
# Check boot options specified
bootoptions = subprocess.check_output(['/bin/bootOption', '-a'])
if not(bootoptions.find('nounlocker')):
if bootoptions.find(b'nounlocker') == -1:
# Run unlocker code
main()
else:
# Exit if "nounlocker" boot option specified
print('Unlocker disabled by boot option')
38 changes: 34 additions & 4 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,43 @@ maintain on ESXi.

2. Installation
---------------
TO DO
Copy the distribution file to the ESXi host datastore using scp or some other
data transfer system.

Decompress the file from the ESXi console or via SSH:

tar xzvf esxi-unlocker-xxx.tgz

(xxx - will be the version number, for example, 300)

Run the command from the terminal:

./esxi-install.sh

Finally reboot the server.

3. Uninstallation
-----------------
TO DO
Open the ESXi console or login via SSH and chnage to the folder where the files were extracted.

Run the command from the terminal:

./esxi-uninstall.sh

Finally reboot the server.

4. Notes
--------
A. There is a command added called esxi-smctest.sh which can show if the patch is successful. It must be run from a
terminal or SSH session. The output should be:

/bin/vmx
smcPresent = true
custom.vgz false 38725560 B

B. The unlocker can be temporarily disabled during boot by editing the boot options and adding "nounlocker".

4. Thanks
5. Thanks
---------

Thanks to Zenith432 for originally building the C++ unlocker and Mac Son of Knife
Expand All @@ -46,7 +76,7 @@ The code is available at https://github.com/DrDonk/esxi-unlocker

History
-------
24/09/18 3.0.0 - First release
26/09/18 3.0.0 - First release


(c) 2011-2018 Dave Parsons

0 comments on commit a3f79b0

Please sign in to comment.