Fixing OS detection on Cygwin

This commit is contained in:
deajan 2016-11-22 19:02:13 +01:00
parent b3d17f8fec
commit c3013347bb
1 changed files with 15 additions and 19 deletions

View File

@ -1,6 +1,6 @@
#### MINIMAL-FUNCTION-SET BEGIN #### #### MINIMAL-FUNCTION-SET BEGIN ####
## FUNC_BUILD=2016112204 ## FUNC_BUILD=2016112205
## 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:
@ -962,16 +962,14 @@ function GetLocalOS {
localOsVar="BusyBox" localOsVar="BusyBox"
else else
# Detecting the special ubuntu userland in Windows 10 bash # 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 2>&1; then
if grep -i Microsoft /proc/sys/kernel/osrelease > /dev/null; then localOsVar="Microsoft"
localOsVar="Microsoft" else
else localOsVar="$(uname -spio 2>&1)"
localOsVar="$(uname -spio 2>&1)" if [ $? != 0 ]; then
localOsVar="$(uname -v 2>&1)"
if [ $? != 0 ]; then if [ $? != 0 ]; then
localOsVar="$(uname -v 2>&1)" localOsVar="$(uname)"
if [ $? != 0 ]; then
localOsVar="$(uname)"
fi
fi fi
fi fi
fi fi
@ -1033,16 +1031,14 @@ function GetOs {
localOsVar="BusyBox" localOsVar="BusyBox"
else else
# Detecting the special ubuntu userland in Windows 10 bash # 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 2>&1; then
if grep -i Microsoft /proc/sys/kernel/osrelease > /dev/null; then localOsVar="Microsoft"
localOsVar="Microsoft" else
else localOsVar="$(uname -spio 2>&1)"
localOsVar="$(uname -spio 2>&1)" if [ $? != 0 ]; then
localOsVar="$(uname -v 2>&1)"
if [ $? != 0 ]; then if [ $? != 0 ]; then
localOsVar="$(uname -v 2>&1)" localOsVar="$(uname)"
if [ $? != 0 ]; then
localOsVar="$(uname)"
fi
fi fi
fi fi
fi fi