diff --git a/dev/ofunctions.sh b/dev/ofunctions.sh index 9e38927..31895c6 100644 --- a/dev/ofunctions.sh +++ b/dev/ofunctions.sh @@ -1,6 +1,6 @@ #### MINIMAL-FUNCTION-SET BEGIN #### -## FUNC_BUILD=2016112201 +## FUNC_BUILD=2016112202 ## 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: @@ -960,6 +960,9 @@ function GetLocalOS { # 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 localOsVar="BusyBox" + # Detecting the special ubuntu userland in Windows 10 bash + elif [ -f /proc/sys/kernel/osrelease ]; then + localOsVar="$(cat /proc/sys/kernel/osrelease)" else localOsVar="$(uname -spio 2>&1)" if [ $? != 0 ]; then @@ -984,6 +987,9 @@ function GetLocalOS { *"MINGW32"*|*"CYGWIN"*) LOCAL_OS="msys" ;; + *"Microsoft"*) + LOCAL_OS)="WinNT10" + ;; *"Darwin"*) LOCAL_OS="MacOSX" ;; @@ -1021,6 +1027,9 @@ function GetOs { # 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 localOsVar="BusyBox" + elif [ -f /proc/sys/kernel/osrelease ]; then + localOsVar="$(cat /proc/sys/kernel/osrelease)" + else localOsVar="$(uname -spio 2>&1)" if [ $? != 0 ]; then @@ -1053,6 +1062,9 @@ ENDSSH *"MINGW32"*|*"CYGWIN"*) REMOTE_OS="msys" ;; + *"Microsoft"*) + REMOTE_OS="WinNT10" + ;; *"Darwin"*) REMOTE_OS="MacOSX" ;;