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

Commit 42cb76c

Browse files
authored
making sure WSL runs the Windows executable
1 parent 3ba024f commit 42cb76c

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

macos-guest-virtualbox.sh

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# One-key semi-automatic installer of macOS on VirtualBox
33
# (c) img2tab, licensed under GPL2.0 or higher
44
# url: https://github.com/img2tab/macos-guest-virtualbox
5-
# version 0.62.1
5+
# version 0.63.0
66

77
# Requirements: 37.5GB available storage on host
88
# Dependencies: bash>=4.0, unzip, wget, dmg2img,
@@ -102,9 +102,9 @@ fi
102102
# VirtualBox in ${PATH}
103103
# Cygwin
104104
if [ -n "$(cygcheck -V 2>/dev/null)" ]; then
105-
if [ -n "$(cmd.exe /d /s /c call VBoxManage -v 2>/dev/null)" ]; then
105+
if [ -n "$(cmd.exe /d /s /c call VBoxManage.exe -v 2>/dev/null)" ]; then
106106
function VBoxManage() {
107-
cmd.exe /d /s /c call VBoxManage "$@"
107+
cmd.exe /d /s /c call VBoxManage.exe "$@"
108108
}
109109
else
110110
cmd_path_VBoxManage='C:\Program Files\Oracle\VirtualBox\VBoxManage.exe'
@@ -117,24 +117,29 @@ if [ -n "$(cygcheck -V 2>/dev/null)" ]; then
117117
echo "Found VBoxManage"
118118
else
119119
echo "Please make sure VirtualBox is installed, and that the path to the"
120-
echo "VBoxManage executable is in the PATH variable, or assigned in the script"
120+
echo "VBoxManage.exe executable is in the PATH variable, or assigned in the script"
121121
printf 'to the variable '${whiteonblack}'cmd_path_VBoxManage'${defaultcolor}' including the name of the executable.'
122122
exit
123123
fi
124124
fi
125125
# Windows Subsystem for Linux (WSL)
126126
elif [[ "$(cat /proc/sys/kernel/osrelease 2>/dev/null)" =~ Microsoft ]]; then
127-
wsl_path_VBoxManage='/mnt/c/Program Files/Oracle/VirtualBox/VBoxManage.exe'
128-
if [ -z "$(VBoxManage -v 2>/dev/null)" ]; then
127+
if [ -n "$(VBoxManage.exe -v 2>/dev/null)" ]; then
128+
function VBoxManage() {
129+
VBoxManage.exe "$@"
130+
}
131+
else
132+
wsl_path_VBoxManage='/mnt/c/Program Files/Oracle/VirtualBox/VBoxManage.exe'
133+
echo "Can't find VBoxManage in PATH variable,"
129134
echo "checking ${wsl_path_VBoxManage}"
130135
if [ -n "$("${wsl_path_VBoxManage}" -v 2>/dev/null)" ]; then
131136
function VBoxManage() {
132137
"${wsl_path_VBoxManage}" "$@"
133138
}
134139
echo "Found VBoxManage"
135140
else
136-
echo "Please make sure VirtualBox is installed, and that the path to the"
137-
echo "VBoxManage executable is in the PATH variable, or assigned in the script"
141+
echo "Please make sure VirtualBox is installed on Windows, and that the path to the"
142+
echo "VBoxManage.exe executable is in the PATH variable, or assigned in the script"
138143
printf 'to the variable '${whiteonblack}'wsl_path_VBoxManage'${defaultcolor}' including the name of the executable.'
139144
exit
140145
fi

0 commit comments

Comments
 (0)