Skip to content

Commit

Permalink
updating to be VMWare 17.6.2 compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
elreydetoda committed Dec 31, 2024
1 parent 8644a42 commit 874bce8
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions packer-vmware/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,21 @@ function vmware_prep(){
echo "Setting up VMWare"
/usr/bin/vmware-modconfig --console --install-all
/etc/init.d/vmware start
/etc/init.d/vmware-USBArbitrator start
}

function main(){
VMWARE_SN="${VMWARE_LIC_KEY:-}"
PREP_ONLY="${PREP_ONLY:-}"

if [[ -n "${VMWARE_SN}" ]] ; then
apt list --installed 2>/dev/null | grep -q linux-headers || ubuntu_prep
(
[[ -x "/usr/bin/vmware" ]] &&
lsmod | grep -q 'vmmon' &&
lsmod | grep -q 'vmnet'
) || vmware_prep
/usr/lib/vmware/bin/vmware-vmx --new-sn "${VMWARE_SN}"
/usr/bin/vmware-networks --start
[[ -n "${PREP_ONLY}" ]] || ( packer init "${BUILD_FOLDER}" && packer "${@}" "${BUILD_FOLDER}" )
else
echo "Please set your VMWare licence as an environment variable of VMWARE_LIC_KEY"
echo " (i.e. VMWARE_LIC_KEY='xxxxx-xxxxx-xxxxx-xxxxx-xxxxx')"
exit 1
fi
apt list --installed 2>/dev/null | grep -q linux-headers || ubuntu_prep
(
[[ -x "/usr/bin/vmware" ]] &&
lsmod | grep -q 'vmmon' &&
lsmod | grep -q 'vmnet'
) || vmware_prep
[[ -n "${VMWARE_SN}" ]] && /usr/lib/vmware/bin/vmware-vmx --new-sn "${VMWARE_SN}"
/usr/bin/vmware-networks --start
[[ -n "${PREP_ONLY}" ]] || ( packer init "${BUILD_FOLDER}" && packer "${@}" "${BUILD_FOLDER}" )
}

# https://elrey.casa/bash/scripting/main
Expand Down

0 comments on commit 874bce8

Please sign in to comment.