mirror of
https://github.com/palera1n/palera1n.git
synced 2026-12-05 07:44:36 +01:00
Add WSL/VM detection (improved) (#332)
This commit is contained in:
1 parent
cad049dd41
commit
11fe6f84df
1 file changed
+36
+36
@@ -32,6 +32,40 @@ fs=disk0s1s$disk
|
|||||||
# =========
|
# =========
|
||||||
# Functions
|
# Functions
|
||||||
# =========
|
# =========
|
||||||
|
|
||||||
|
check_wsl() {
|
||||||
|
if [[ $(uname -r) == *[mM]icrosoft* ]]; then
|
||||||
|
echo "You appear to be using Windows Subsystem for Linux (WSL)."
|
||||||
|
echo "palera1n will most likely NOT WORK with this setup."
|
||||||
|
echo "No support will be provided for WSL users."
|
||||||
|
read -r -n 1 -p "Continue? [y/N] " confirm
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
[[ $confirm == [yY] ]] || exit 0
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
check_vm() {
|
||||||
|
vm=0
|
||||||
|
|
||||||
|
if [ "$os" = "Darwin" ]; then
|
||||||
|
[[ $(ioreg -l 2>/dev/null || true) == *@(Oracle|VirtualBox|VMware|Parallels|QEMU)* ]] && vm=1
|
||||||
|
elif [ "$os" = "Linux" ]; then
|
||||||
|
[[ $(cat /proc/cpuinfo 2>/dev/null || true) == *hypervisor* ]] && vm=1
|
||||||
|
[[ $(hostnamectl 2>/dev/null || true) == *@("Chassis: vm"|Virtualization:)* ]] && vm=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if (( vm )); then
|
||||||
|
echo "You appear to be using a virtual machine (VM)."
|
||||||
|
echo "palera1n will most likely NOT WORK with this setup, unless you're using KVM with full USB controller passthrough."
|
||||||
|
echo "No support will be provided for VM users."
|
||||||
|
read -r -n 1 -p "Continue? [y/N] " confirm
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
[[ $confirm == [yY] ]] || exit 0
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
remote_cmd() {
|
remote_cmd() {
|
||||||
"$dir"/sshpass -p 'alpine' ssh -o StrictHostKeyChecking=no -p6413 root@localhost "$@"
|
"$dir"/sshpass -p 'alpine' ssh -o StrictHostKeyChecking=no -p6413 root@localhost "$@"
|
||||||
}
|
}
|
||||||
@@ -379,6 +413,8 @@ fi
|
|||||||
# ============
|
# ============
|
||||||
# Dependencies
|
# Dependencies
|
||||||
# ============
|
# ============
|
||||||
|
check_wsl
|
||||||
|
check_vm
|
||||||
|
|
||||||
# Check for required commands
|
# Check for required commands
|
||||||
if [ "$os" = 'Linux' ]; then
|
if [ "$os" = 'Linux' ]; then
|
||||||
|
|||||||
Reference in new issue
Block a user