mirror of
https://github.com/lloeki/dotfiles.git
synced 2025-12-06 07:24:39 +01:00
23 lines
768 B
Bash
Executable file
23 lines
768 B
Bash
Executable file
if [[ "${OSTYPE}" == *darwin* ]]; then
|
|
vmrun='/Applications/VMware Fusion.app/Contents/Library/vmrun'
|
|
docker_vmx="${HOME}/Virtual Machines.localized/Docker.vmwarevm/Docker.vmx"
|
|
|
|
if [[ -f "${vmrun}" && -f "${docker_vmx}" ]]; then
|
|
if "${vmrun}" list | grep -q "${docker_vmx}"; then
|
|
:
|
|
else
|
|
# TODO: user feedback facilities
|
|
echo "* Starting Docker VM"
|
|
"${vmrun}" start "${docker_vmx}" nogui
|
|
fi
|
|
|
|
# TODO: make this faster
|
|
# - look into /var/db/vmware/vmnet-dhcpd-vmnet{1,8}.leases
|
|
# - cache found IP
|
|
docker_vm_ip="$("${vmrun}" getGuestIPAddress "${docker_vmx}" -wait)"
|
|
|
|
export DOCKER_HOST="ssh://docker@${docker_vm_ip}"
|
|
fi
|
|
fi
|
|
|
|
# vim: ft=bash
|