install.fairie/home/.chezmoiscripts/universal/run_onchange_after_46_virtualbox.tmpl
Brian Zalewski a4fe3b7e3a Update 2 files
- /home/.chezmoiscripts/universal/run_onchange_after_45-vmware.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_46_virtualbox.tmpl
2023-02-01 07:04:55 +00:00

33 lines
1.3 KiB
Cheetah

{{- if ne .host.distro.family "windows" -}}
#!/usr/bin/env bash
{{ includeTemplate "universal/profile" }}
{{ includeTemplate "universal/logg" }}
### 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
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
### 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
{{ end -}}