better WSLg detection, still extremely slow

If you're using WSLg, consider using KVM instead of VirtualBox
This commit is contained in:
Jack
2021-09-27 11:41:05 +03:00
committed by GitHub
parent 8968e1028d
commit 9099277a2d
+20 -17
View File
@@ -2,7 +2,7 @@
# Push-button installer of macOS on VirtualBox
# (c) myspaghetti, licensed under GPL2.0 or higher
# url: https://github.com/myspaghetti/macos-virtualbox
# version 0.99.1.1
# version 0.99.1.2
# Dependencies: bash coreutils gzip unzip wget xxd dmg2img
# Optional features: tesseract-ocr tesseract-ocr-eng
@@ -280,6 +280,21 @@ if [[ -n "$(cygcheck -V 2>/dev/null)" ]]; then
exit
fi
fi
# Windows Subsystem for Linux 2 (WSL2 or WSLg)
elif [[ "$(cat /proc/sys/kernel/osrelease 2>/dev/null)" =~ WSL[2Gg] ]]; then # WSL2 or WSLg
if [[ -n "$(VBoxManage -v 2>/dev/null)" ]]; then
if [[ ! "$(lsmod)" =~ vboxdrv ]]; then # if the vboxdrv kernel module is not present
echo "The script appears to be executed on WSL2 or WSLg."
echo "Mind that WSL2 and WSLg require kernel module compilation and"
echo "custom configuration that is not supported by the script."
echo "If the script does not detect the ${highlight_color}vboxdrv${default_color} kernel module, it exits."
exit
fi
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."
exit
fi
# Windows Subsystem for Linux (WSL "1")
elif [[ "$(cat /proc/sys/kernel/osrelease 2>/dev/null)" =~ [Mm]icrosoft ]]; then
if [[ -n "$(VBoxManage.exe -v 2>/dev/null)" ]]; then
@@ -297,22 +312,10 @@ elif [[ "$(cat /proc/sys/kernel/osrelease 2>/dev/null)" =~ [Mm]icrosoft ]]; then
}
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
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 -e "to the variable \"${highlight_color}wsl_path_VBoxManage${default_color}\" including the name of the executable."
exit
fi
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 -e "to the variable \"${highlight_color}wsl_path_VBoxManage${default_color}\" including the name of the executable."
exit
fi
fi
# everything else (not cygwin and not wsl)