install.fairie/home/.chezmoiscripts/universal/run_onchange_after_45-vmware.tmpl

34 lines
1.1 KiB
Cheetah
Raw Normal View History

{{- if ne .host.distro.family "windows" -}}
#!/usr/bin/env bash
{{ includeTemplate "universal/profile" }}
{{ includeTemplate "universal/logg" }}
### Only run logic if VMWare is installed
if command -v vmware > /dev/null; then
### Build Kernel Modules
if sudo vmware-modconfig --console --install-all; then
:
else
VMW_VERSION=$(vmware --version | cut -f 3 -d' ')
mkdir -p /tmp/vmw_patch
cd /tmp/vmw_patch
curl 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
sudo make
sudo make install
fi
###Install Unlocker
UNLOCKER_URL=$(curl https://api.github.com/repos/DrDonk/unlocker/releases/latest | jq -r '.assets[0].browser_download_url')
mkdir -p /tmp/vmw_unlocker
cd /tmp/vmw_unlocker
curl $UNLOCKER_URL -o /tmp/vmw_unlocker/unlocker.zip
unzip /tmp/vmw_unlocker/unlocker.zip
echo "y" | sudo ./unlock
else
logg warn 'VMware Workstation is not installed so the VMware Unlocker will not be installed'
fi
{{ end -}}