From 402adba19177960060a2968db6cf94e0b03bdfaa Mon Sep 17 00:00:00 2001 From: deajan Date: Wed, 26 Apr 2017 21:03:04 +0200 Subject: [PATCH] Fixed GetRemoteOS os-release getinfo --- dev/ofunctions.sh | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/dev/ofunctions.sh b/dev/ofunctions.sh index edf2380..b24eed1 100644 --- a/dev/ofunctions.sh +++ b/dev/ofunctions.sh @@ -2,8 +2,8 @@ #### OFUNCTIONS FULL SUBSET #### #### OFUNCTIONS MINI SUBSET #### -_OFUNCTIONS_VERSION=2.1.2 -_OFUNCTIONS_BUILD=2017052604 +_OFUNCTIONS_VERSION=2.1.3 +_OFUNCTIONS_BUILD=2017052605 #### _OFUNCTIONS_BOOTSTRAP SUBSET #### _OFUNCTIONS_BOOTSTRAP=true #### _OFUNCTIONS_BOOTSTRAP SUBSET END #### @@ -1179,9 +1179,6 @@ function GetLocalOS { exit 1 ;; esac - if [ "$_OFUNCTIONS_VERSION" != "" ]; then - Logger "Local OS: [$localOsVar]." "DEBUG" - fi # Get linux versions if [ -f "/etc/os-release" ]; then @@ -1191,6 +1188,10 @@ function GetLocalOS { # Add a global variable for statistics in installer LOCAL_OS_FULL="$localOsVar ($localOsName $localOsVer)" + + if [ "$_OFUNCTIONS_VERSION" != "" ]; then + Logger "Local OS: [$LOCAL_OS_FULL]." "DEBUG" + fi } #### GetLocalOS SUBSET END #### @@ -1263,11 +1264,14 @@ function GetRemoteOS { $SSH_CMD env _REMOTE_TOKEN="$_REMOTE_TOKEN" bash -s << 'ENDSSH' >> "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" 2>&1 + function GetOs { local localOsVar local localOsName local localOsVer + local osInfo="/etc/os-release" + # 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" @@ -1286,9 +1290,11 @@ function GetOs { fi fi # Get linux versions - if [ -f "/etc/os-release" ]; then - localOsName=$(GetConfFileValue "/etc/os-release" "NAME") - localOsVer=$(GetConfFileValue "/etc/os-release" "VERSION") + if [ -f "$osInfo" ]; then + localOsName=$(grep "^NAME=" "$osInfo") + localOsName="${localOsName##*=}" + localOsVer=$(grep "^VERSION=" "$osInfo") + localOsVer="${localOsVer##*=}" fi echo "$localOsVar ($localOsName $localOsVer)"