From a63e85c6a65e26e4538bb9d8cafd1d9acba50e7a Mon Sep 17 00:00:00 2001 From: img2tab <31696646+img2tab@users.noreply.github.com> Date: Wed, 6 Mar 2019 04:37:18 +0000 Subject: [PATCH] check if VBoxManage executes --- macos-guest-virtualbox.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/macos-guest-virtualbox.sh b/macos-guest-virtualbox.sh index 48fcaa9..4345046 100644 --- a/macos-guest-virtualbox.sh +++ b/macos-guest-virtualbox.sh @@ -90,18 +90,18 @@ fi # VirtualBox in ${PATH} if [ -z "$(VBoxManage -v 2>/dev/null)" ]; then - if [ -x '/mnt/c/Program Files/Oracle/VirtualBox/VBoxManage.exe' ]; then + if [ -n "$('/mnt/c/Program Files/Oracle/VirtualBox/VBoxManage.exe' -v 2>/dev/null)" ]; then # If VBoxManage.exe is in the standard install location, use it. - VBoxManage () { + function VBoxManage() { '/mnt/c/Program Files/Oracle/VirtualBox/VBoxManage.exe' "$@" } + elif [ -n "$('/cygdrive/c/Program Files/Oracle/VirtualBox/VBoxManage.exe' -v 2>/dev/null)" ]; then + function VBoxManage() { + '/cygdrive/c/Program Files/Oracle/VirtualBox/VBoxManage.exe' "$@" + } else echo "Please make sure VirtualBox is installed, and that the path to" echo "the VBoxManage executable is in the PATH variable." - if [ -n "${windows}" ]; then echo -n "VBoxManage is usually installed in" - echo "/cygdrive/c/Program Files/Oracle/VirtualBox" - echo "and can be added with PATH=\"\${PATH}:/cygdrive/c/<...>\"" - fi exit fi fi