WSL2/WSLg error messages

This commit is contained in:
My Spaghetti
2021-08-23 20:07:02 +03:00
parent 62e5f47ba9
commit 45bf3a436a
+14 -4
View File
@@ -2,7 +2,7 @@
# Push-button installer of macOS on VirtualBox # Push-button installer of macOS on VirtualBox
# (c) myspaghetti, licensed under GPL2.0 or higher # (c) myspaghetti, licensed under GPL2.0 or higher
# url: https://github.com/myspaghetti/macos-virtualbox # url: https://github.com/myspaghetti/macos-virtualbox
# version 0.99.1.0 # version 0.99.1.1
# Dependencies: bash coreutils gzip unzip wget xxd dmg2img # Dependencies: bash coreutils gzip unzip wget xxd dmg2img
# Optional features: tesseract-ocr tesseract-ocr-eng # Optional features: tesseract-ocr tesseract-ocr-eng
@@ -280,14 +280,12 @@ if [[ -n "$(cygcheck -V 2>/dev/null)" ]]; then
exit exit
fi fi
fi fi
# Windows Subsystem for Linux (WSL) # Windows Subsystem for Linux (WSL "1")
elif [[ "$(cat /proc/sys/kernel/osrelease 2>/dev/null)" =~ [Mm]icrosoft ]]; then elif [[ "$(cat /proc/sys/kernel/osrelease 2>/dev/null)" =~ [Mm]icrosoft ]]; then
if [[ -n "$(VBoxManage.exe -v 2>/dev/null)" ]]; then if [[ -n "$(VBoxManage.exe -v 2>/dev/null)" ]]; then
function VBoxManage() { function VBoxManage() {
VBoxManage.exe "$@" VBoxManage.exe "$@"
} }
elif [[ -n "$(VBoxManage -v 2>/dev/null)" ]]; then # WSLg
true # do nothing
else else
wsl_path_VBoxManage='/mnt/c/Program Files/Oracle/VirtualBox/VBoxManage.exe' wsl_path_VBoxManage='/mnt/c/Program Files/Oracle/VirtualBox/VBoxManage.exe'
echo "Can't find VBoxManage in PATH variable," echo "Can't find VBoxManage in PATH variable,"
@@ -298,6 +296,17 @@ elif [[ "$(cat /proc/sys/kernel/osrelease 2>/dev/null)" =~ [Mm]icrosoft ]]; then
VBoxManage.exe "$@" VBoxManage.exe "$@"
} }
echo "Found VBoxManage" echo "Found VBoxManage"
else
if [[ "$(cat /proc/sys/kernel/osrelease 2>/dev/null)" =~ WSL[2Gg] ]]; then # WSL2 or WSLg
if [[ -n "$(VBoxManage -v 2>/dev/null)" ]]; then
true # do nothing
else
echo "Please make sure VirtualBox version 5.2 or higher is installed,"
echo "and that the path to the VBoxManage executable is in the PATH variable."
echo "Mind that WSL2 and WSLg require kernel module compilation and custom"
echo "configuration that is not supported by the script."
exit
fi
else else
echo "Please make sure VirtualBox is installed on Windows, and that the path to the" 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" echo "VBoxManage.exe executable is in the PATH variable, or assigned in the script"
@@ -305,6 +314,7 @@ elif [[ "$(cat /proc/sys/kernel/osrelease 2>/dev/null)" =~ [Mm]icrosoft ]]; then
exit exit
fi fi
fi fi
fi
# everything else (not cygwin and not wsl) # everything else (not cygwin and not wsl)
elif [[ -z "$(VBoxManage -v 2>/dev/null)" ]]; then elif [[ -z "$(VBoxManage -v 2>/dev/null)" ]]; then
echo "Please make sure VirtualBox version 5.2 or higher is installed," echo "Please make sure VirtualBox version 5.2 or higher is installed,"