From a4fe3b7e3ac0b5b9ab2f7b563db677d61744e353 Mon Sep 17 00:00:00 2001 From: Brian Zalewski Date: Wed, 1 Feb 2023 07:04:55 +0000 Subject: [PATCH] Update 2 files - /home/.chezmoiscripts/universal/run_onchange_after_45-vmware.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_46_virtualbox.tmpl --- .../run_onchange_after_45-vmware.tmpl | 7 ++++-- .../run_onchange_after_46_virtualbox.tmpl | 22 ++++++++++++++----- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/home/.chezmoiscripts/universal/run_onchange_after_45-vmware.tmpl b/home/.chezmoiscripts/universal/run_onchange_after_45-vmware.tmpl index c297ead7..ca606bad 100644 --- a/home/.chezmoiscripts/universal/run_onchange_after_45-vmware.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_after_45-vmware.tmpl @@ -4,18 +4,21 @@ {{ includeTemplate "universal/profile" }} {{ includeTemplate "universal/logg" }} -### Only run logic if VMWare is installed +### Run logic if VMWare is installed if command -v vmware > /dev/null; then - ### Build Kernel Modules + ### Build kernel modules + # TODO - Add check to see if kernel modules are required before running this logic if sudo vmware-modconfig --console --install-all; then : else + logg info 'Acquiring VMWare version from CLI' VMW_VERSION=$(vmware --version | cut -f 3 -d' ') mkdir -p /tmp/vmw_patch cd /tmp/vmw_patch 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 tar -xzf /tmp/vmw_patch/workstation.tar.gz + cd vmware* logg info 'Running `sudo make` and `sudo make install`' sudo make sudo make install diff --git a/home/.chezmoiscripts/universal/run_onchange_after_46_virtualbox.tmpl b/home/.chezmoiscripts/universal/run_onchange_after_46_virtualbox.tmpl index 3d7a3e0c..27b8bcbf 100644 --- a/home/.chezmoiscripts/universal/run_onchange_after_46_virtualbox.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_after_46_virtualbox.tmpl @@ -4,16 +4,28 @@ {{ includeTemplate "universal/profile" }} {{ includeTemplate "universal/logg" }} -### Only run logic if VirtualBox is installed +### Run logic if VirtualBox is installed +# TODO - Add check to determine if ExtensionPack is required if command -v VirtualBox > /dev/null; then - ###Install VirtualBox Extension pack - VBOX_VERSION=$(VirtualBox --help | head -n 1 | cut -f 6 -d' ') - VBOX_VERSION=${VBOX_VERSION//v} + ### Install VirtualBox extension pack + logg info 'Acquiring VirtualBox version information' + VBOX_VERSION="$(VirtualBox --help | head -n 1 | cut -f 6 -d' ')" + VBOX_VERSION="${VBOX_VERSION//v}" + + ### Set up folders mkdir -p /usr/lib/virtualbox/ExtensionPacks + mkdir -p /tmp/vbox cd /tmp/vbox - curl https://download.virtualbox.org/virtualbox/$VBOX_VERSION/Oracle_VM_VirtualBox_Extension_Pack-$VBOX_VERSION.vbox-extpack \ + + ### Download extension pack + logg info 'Downloading VirtualBox extension pack' + curl -sSL https://download.virtualbox.org/virtualbox/$VBOX_VERSION/Oracle_VM_VirtualBox_Extension_Pack-$VBOX_VERSION.vbox-extpack \ -o /tmp/vbox/Oracle_VM_VirtualBox_Extension_Pack-$VBOX_VERSION.vbox-extpack + + ### Install extension pack + logg info 'Installing VirtualBox extension pack' echo 'y' | VBoxManage extpack install --replace /tmp/vbox/Oracle_VM_VirtualBox_Extension_Pack-$VBOX_VERSION.vbox-extpack + logg success 'Successfully installed VirtualBox extension pack' else logg warn 'VirtualBox is not installed so VirtualBox Extension pack will not be installed' fi