Skip to content
This repository has been archived by the owner on Feb 15, 2024. It is now read-only.

Commit

Permalink
making sure WSL runs the Windows executable
Browse files Browse the repository at this point in the history
  • Loading branch information
myspaghetti authored May 31, 2019
1 parent 3ba024f commit 42cb76c
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions macos-guest-virtualbox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# One-key semi-automatic installer of macOS on VirtualBox
# (c) img2tab, licensed under GPL2.0 or higher
# url: https://github.com/img2tab/macos-guest-virtualbox
# version 0.62.1
# version 0.63.0

# Requirements: 37.5GB available storage on host
# Dependencies: bash>=4.0, unzip, wget, dmg2img,
Expand Down Expand Up @@ -102,9 +102,9 @@ fi
# VirtualBox in ${PATH}
# Cygwin
if [ -n "$(cygcheck -V 2>/dev/null)" ]; then
if [ -n "$(cmd.exe /d /s /c call VBoxManage -v 2>/dev/null)" ]; then
if [ -n "$(cmd.exe /d /s /c call VBoxManage.exe -v 2>/dev/null)" ]; then
function VBoxManage() {
cmd.exe /d /s /c call VBoxManage "$@"
cmd.exe /d /s /c call VBoxManage.exe "$@"
}
else
cmd_path_VBoxManage='C:\Program Files\Oracle\VirtualBox\VBoxManage.exe'
Expand All @@ -117,24 +117,29 @@ if [ -n "$(cygcheck -V 2>/dev/null)" ]; then
echo "Found VBoxManage"
else
echo "Please make sure VirtualBox is installed, and that the path to the"
echo "VBoxManage executable is in the PATH variable, or assigned in the script"
echo "VBoxManage.exe executable is in the PATH variable, or assigned in the script"
printf 'to the variable '${whiteonblack}'cmd_path_VBoxManage'${defaultcolor}' including the name of the executable.'
exit
fi
fi
# Windows Subsystem for Linux (WSL)
elif [[ "$(cat /proc/sys/kernel/osrelease 2>/dev/null)" =~ Microsoft ]]; then
wsl_path_VBoxManage='/mnt/c/Program Files/Oracle/VirtualBox/VBoxManage.exe'
if [ -z "$(VBoxManage -v 2>/dev/null)" ]; then
if [ -n "$(VBoxManage.exe -v 2>/dev/null)" ]; then
function VBoxManage() {
VBoxManage.exe "$@"
}
else
wsl_path_VBoxManage='/mnt/c/Program Files/Oracle/VirtualBox/VBoxManage.exe'
echo "Can't find VBoxManage in PATH variable,"
echo "checking ${wsl_path_VBoxManage}"
if [ -n "$("${wsl_path_VBoxManage}" -v 2>/dev/null)" ]; then
function VBoxManage() {
"${wsl_path_VBoxManage}" "$@"
}
echo "Found VBoxManage"
else
echo "Please make sure VirtualBox is installed, and that the path to the"
echo "VBoxManage executable is in the PATH variable, or assigned in the script"
echo "Please make sure VirtualBox is installed on Windows, and that the path to the"
echo "VBoxManage.exe executable is in the PATH variable, or assigned in the script"
printf 'to the variable '${whiteonblack}'wsl_path_VBoxManage'${defaultcolor}' including the name of the executable.'
exit
fi
Expand Down

0 comments on commit 42cb76c

Please sign in to comment.