Update file run_onchange_after_45-vmware.tmpl

This commit is contained in:
Brian Zalewski 2023-02-02 02:49:45 +00:00
parent bd78ad976d
commit d877c7e765

View file

@ -7,17 +7,17 @@
### Run logic if VMware is installed ### Run logic if VMware is installed
if command -v vmware > /dev/null; then if command -v vmware > /dev/null; then
### Build kernel modules if they are not present ### Build kernel modules if they are not present
if [ ! -f /lib/modules/$(uname -r)/misc/vmmon.ko || ! -f /lib/modules/$(uname -r)/misc/vmnet.ko ]; then if [ ! -f "/lib/modules/$(uname -r)/misc/vmmon.ko" ] || [ ! -f "/lib/modules/$(uname -r)/misc/vmnet.ko" ]; then
logg info 'Building VMware host modules' logg info 'Building VMware host modules'
if sudo vmware-modconfig --console --install-all; then if sudo vmware-modconfig --console --install-all; then
: logg success 'Built VMWare host modules successfully with `sudo vmware-modconfig --console --install-all`'
else else
logg info 'Acquiring VMware version from CLI' logg info 'Acquiring VMware version from CLI'
VMW_VERSION=$(vmware --version | cut -f 3 -d' ') VMW_VERSION="$(vmware --version | cut -f 3 -d' ')"
mkdir -p /tmp/vmw_patch mkdir -p /tmp/vmw_patch
cd /tmp/vmw_patch cd /tmp/vmw_patch
logg info 'Downloading VMware host module patches' logg info 'Downloading VMware host module patches'
curl -sSL https://github.com/mkubecek/vmware-host-modules/archive/workstation-$VMW_VERSION.tar.gz -o /tmp/vmw_patch/workstation.tar.gz curl -sSL "https://github.com/mkubecek/vmware-host-modules/archive/workstation-$VMW_VERSION.tar.gz" -o /tmp/vmw_patch/workstation.tar.gz
tar -xzf /tmp/vmw_patch/workstation.tar.gz tar -xzf /tmp/vmw_patch/workstation.tar.gz
cd vmware* cd vmware*
logg info 'Running `sudo make` and `sudo make install`' logg info 'Running `sudo make` and `sudo make install`'
@ -32,8 +32,8 @@ if command -v vmware > /dev/null; then
mkdir -p /tmp/vmware mkdir -p /tmp/vmware
cd /tmp/vmware cd /tmp/vmware
openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -nodes -days 36500 -subj "/CN=VMware/" openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -nodes -days 36500 -subj "/CN=VMware/"
/usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./MOK.priv ./MOK.der $(modinfo -n vmmon) "/usr/src/linux-headers-$(uname -r)/scripts/sign-file" sha256 ./MOK.priv ./MOK.der "$(modinfo -n vmmon)"
/usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./MOK.priv ./MOK.der $(modinfo -n vmnet) "/usr/src/linux-headers-$(uname -r)/scripts/sign-file" sha256 ./MOK.priv ./MOK.der "$(modinfo -n vmnet)"
echo '' | mokutil --import MOK.der echo '' | mokutil --import MOK.der
logg success 'Successfully signed VMware host modules. Reboot the host before powering on VMs' logg success 'Successfully signed VMware host modules. Reboot the host before powering on VMs'
fi fi
@ -41,7 +41,7 @@ if command -v vmware > /dev/null; then
### Patch VMware with Unlocker ### Patch VMware with Unlocker
if [ ! -f /usr/lib/vmware/isoimages/darwin.iso ]; then if [ ! -f /usr/lib/vmware/isoimages/darwin.iso ]; then
logg info 'Acquiring VMware Unlocker latest release version' logg info 'Acquiring VMware Unlocker latest release version'
UNLOCKER_URL=$(curl -sSL https://api.github.com/repos/DrDonk/unlocker/releases/latest | jq -r '.assets[0].browser_download_url') UNLOCKER_URL="$(curl -sSL 'https://api.github.com/repos/DrDonk/unlocker/releases/latest' | jq -r '.assets[0].browser_download_url')"
mkdir -p /tmp/vmware-unlocker mkdir -p /tmp/vmware-unlocker
cd /tmp/vmware-unlocker cd /tmp/vmware-unlocker
logg info 'Downloading unlocker.zip' logg info 'Downloading unlocker.zip'