Skip to content

Commit

Permalink
Removing support for ESXi 6.x as unreliable - 2.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
DrDonk committed Oct 11, 2017
1 parent af5102b commit fd216eb
Show file tree
Hide file tree
Showing 8 changed files with 197 additions and 4 deletions.
13 changes: 13 additions & 0 deletions esxi/esxi-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh
set -e
#set -x

# Ensure we only use unmodified commands
export PATH=/bin:/sbin:/usr/bin:/usr/sbin

# Copy patch to local.sh
rm -fv local.sh
cp local-prefix.sh local.sh
cat unlocker.py >> local.sh
cat local-suffix.sh >> local.sh
chmod +x local.sh
29 changes: 29 additions & 0 deletions esxi/esxi-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/sh
set -e
#set -x

echo VMware Unlocker 2.1.0
echo ===============================
echo Copyright: Dave Parsons 2011-17

# Ensure we only use unmodified commands
export PATH=/bin:/sbin:/usr/bin:/usr/sbin

VER=$(uname -r)
if [ "$VER" == "6.0.0" ]; then
echo "Error - ESXi 6.0.0 is not supported!"
elif [ "$VER" == "6.5.0" ]; then
# Copy patch to local.sh
echo Installing local.sh
chmod +x local.sh
cp local.sh /etc/rc.local.d/local.sh
python esxiconfig.py on
backup.sh 0
echo "Success - please now restart the server!"
else
echo "Unknown ESXi version"
fi




4 changes: 4 additions & 0 deletions esxi/esxi-smctest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +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]*//'
16 changes: 16 additions & 0 deletions esxi/esxi-uninstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh
set -e
#set -x

echo VMware Unlocker 2.1.0
echo ===============================
echo Copyright: Dave Parsons 2011-17

# Ensure we only use unmodified commands
export PATH=/bin:/sbin:/usr/bin:/usr/sbin

echo Uninstalling local.sh
cp /etc/rc.local.d/.#local.sh /etc/rc.local.d/local.sh
python esxiconfig.py off
backup.sh 0
echo Success - please now restart the server!
63 changes: 63 additions & 0 deletions esxi/esxiconfig.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/usr/bin/env python
"""
This is a simple method to modify the hostd XML file
Not using XML on ESXi Python as it does not preserve
formatting or comments.
(This could be sed but cannot find a suitable regex.)
"""
from __future__ import print_function
import sys


def testline(line, test):
sline = line.lstrip()
if sline == test:
return True
else:
return False


def main():
vmsvc = '<vmsvc>\n'
sandbox = '<useVmxSandbox>false</useVmxSandbox>\n'

with open('/etc/vmware/hostd/config.xml', 'r+') as f:
data = f.readlines()

# Search for the relevant XML tags
i = 0
vmsvcindex = 0
sandboxindex = 0
for line in data:

if testline(line, vmsvc):
vmsvcindex = i

if testline(line, sandbox):
sandboxindex = i

# print(line, end='')
i += 1

# Simple toggle on or off depending if found
if sandboxindex != 0 and sys.argv[1] == 'off':
print('Removing useVmxSandbox')
del data[sandboxindex]
elif sandboxindex == 0 and sys.argv[1] == 'on':
print('Adding useVmxSandbox')
pad = len(data[vmsvcindex + 1]) - len(data[vmsvcindex + 1].lstrip())
data.insert(vmsvcindex + 1, (" " * pad) + sandbox)
else:
pass

# Rewrite the config.xml file
f.seek(0)
f.write(''.join(data))
f.truncate()
f.close()


if __name__ == '__main__':
main()
65 changes: 65 additions & 0 deletions esxi/local-prefix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/sh
set -e
set -x

echo VMware ESXi 6.x Unlocker 2.1.0
echo ===============================
echo Copyright: Dave Parsons 2011-17

# Ensure we only use unmodified commands
export PATH=/bin:/sbin:/usr/bin:/usr/sbin

# Exit if boot option specified
if bootOption -o | grep -q 'nounlocker'; then
logger -t unlocker disabled via nounlocker boot option
exit 0
fi

# Make sure working files are removed
if [ -d /unlocker ]; then
logger -t unlocker Removing current patches
rm -rfv /unlocker
fi

# Create new RAM disk and map to /unlocker
logger -t unlocker Creating RAM disk
mkdir /unlocker
localcli system visorfs ramdisk add -m 200 -M 200 -n unlocker -p 0755 -t /unlocker
logger -t unlocker Stopping hostd daemon
/etc/init.d/hostd stop

# Copy the vmx files
logger -t unlocker Copying vmx files
mkdir /unlocker/bin
cp /bin/vmx /unlocker/bin/
cp /bin/vmx-debug /unlocker/bin/
cp /bin/vmx-stats /unlocker/bin/

# Setup symlink from /bin
logger -t unlocker Setup vmx sym links
rm -fv /bin/vmx
ln -s /unlocker/bin/vmx /bin/vmx
rm -fv /bin/vmx-debug
ln -s /unlocker/bin/vmx-debug /bin/vmx-debug
rm -fv /bin/vmx-stats
ln -s /unlocker/bin/vmx-stats /bin/vmx-stats

# Copy the libvmkctl.so files
logger -t unlocker Copying 32-bit lib files
mkdir /unlocker/lib
cp /lib/libvmkctl.so /unlocker/lib/
logger -t unlocker Setup 32-bit lib sym links
rm -fv /lib/libvmkctl.so
ln -s /unlocker/lib/libvmkctl.so /lib/libvmkctl.so
if [ -f /lib64/libvmkctl.so ]; then
logger -t unlocker Copying 64-bit lib files
mkdir /unlocker/lib64
cp /lib64/libvmkctl.so /unlocker/lib64/
logger -t unlocker Setup 64-bit lib sym links
rm -fv /lib64/libvmkctl.so
ln -s /unlocker/lib64/libvmkctl.so /lib64/libvmkctl.so
fi

# Patch the vmx files
logger -t unlocker Patching vmx files
python <<END
4 changes: 4 additions & 0 deletions esxi/local-suffix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
END
logger -t unlocker Starting hostd daemon
/etc/init.d/hostd start
exit 0
7 changes: 3 additions & 4 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ macOS Unlocker for VMware V2.1
| ========== |
| |
| Always uninstall the previous version of the Unlocker before using a new |
| version. Failure to do this could render VMware unusablei. |
| version. Failure to do this could render VMware unusable. |
| |
+-----------------------------------------------------------------------------+

Expand All @@ -16,8 +16,7 @@ macOS Unlocker for VMware V2.1
Unlocker 2 is designed for Workstation 11/12/14, Player 7/12/14,
and Fusion 7/8/10.

If you are using an earlier product please continue using Unlocker 1 and use
Unlocker 2.0 for ESXi 6.0
If you are using an earlier product please continue using Unlocker 1.

Version 2 has been tested against:

Expand Down Expand Up @@ -57,7 +56,7 @@ and so does not require Python to be installed.

If you are using VMware Player or Workstation on Windows you may get a core dump.

Latest Linux and ESXi products are OK and do not show this problem.
Latest Linux products are OK and do not show this problem.

+-----------------------------------------------------------------------------+
| IMPORTANT: |
Expand Down

0 comments on commit fd216eb

Please sign in to comment.