Fixed WinNT10 detection

This commit is contained in:
deajan 2016-11-22 18:50:09 +01:00
parent 15630c4b6d
commit b3d17f8fec
1 changed files with 25 additions and 18 deletions

View File

@ -1,6 +1,6 @@
#### MINIMAL-FUNCTION-SET BEGIN #### #### MINIMAL-FUNCTION-SET BEGIN ####
## FUNC_BUILD=2016112203 ## FUNC_BUILD=2016112204
## BEGIN Generic bash functions written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr ## BEGIN Generic bash functions written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr
## To use in a program, define the following variables: ## To use in a program, define the following variables:
@ -960,9 +960,11 @@ function GetLocalOS {
# There's no good way to tell if currently running in BusyBox shell. Using sluggish way. # There's no good way to tell if currently running in BusyBox shell. Using sluggish way.
if ls --help 2>&1 | grep -i "BusyBox" > /dev/null; then if ls --help 2>&1 | grep -i "BusyBox" > /dev/null; then
localOsVar="BusyBox" localOsVar="BusyBox"
else
# Detecting the special ubuntu userland in Windows 10 bash # Detecting the special ubuntu userland in Windows 10 bash
elif [ -f /proc/sys/kernel/osrelease ]; then if [ -f /proc/sys/kernel/osrelease ]; then
localOsVar="$(cat /proc/sys/kernel/osrelease)" if grep -i Microsoft /proc/sys/kernel/osrelease > /dev/null; then
localOsVar="Microsoft"
else else
localOsVar="$(uname -spio 2>&1)" localOsVar="$(uname -spio 2>&1)"
if [ $? != 0 ]; then if [ $? != 0 ]; then
@ -972,6 +974,8 @@ function GetLocalOS {
fi fi
fi fi
fi fi
fi
fi
case $localOsVar in case $localOsVar in
# Android uname contains both linux and android, keep it before linux entry # Android uname contains both linux and android, keep it before linux entry
@ -1027,9 +1031,11 @@ function GetOs {
# There's no good way to tell if currently running in BusyBox shell. Using sluggish way. # There's no good way to tell if currently running in BusyBox shell. Using sluggish way.
if ls --help 2>&1 | grep -i "BusyBox" > /dev/null; then if ls --help 2>&1 | grep -i "BusyBox" > /dev/null; then
localOsVar="BusyBox" localOsVar="BusyBox"
elif [ -f /proc/sys/kernel/osrelease ]; then else
localOsVar="$(cat /proc/sys/kernel/osrelease)" # Detecting the special ubuntu userland in Windows 10 bash
if [ -f /proc/sys/kernel/osrelease ]; then
if grep -i Microsoft /proc/sys/kernel/osrelease > /dev/null; then
localOsVar="Microsoft"
else else
localOsVar="$(uname -spio 2>&1)" localOsVar="$(uname -spio 2>&1)"
if [ $? != 0 ]; then if [ $? != 0 ]; then
@ -1039,7 +1045,8 @@ function GetOs {
fi fi
fi fi
fi fi
fi
fi
echo "$localOsVar" echo "$localOsVar"
} }