Fixed GetRemoteOS os-release getinfo

This commit is contained in:
deajan 2017-04-26 21:03:04 +02:00
parent bc3b6b3a5d
commit 402adba191
1 changed files with 14 additions and 8 deletions

View File

@ -2,8 +2,8 @@
#### OFUNCTIONS FULL SUBSET #### #### OFUNCTIONS FULL SUBSET ####
#### OFUNCTIONS MINI SUBSET #### #### OFUNCTIONS MINI SUBSET ####
_OFUNCTIONS_VERSION=2.1.2 _OFUNCTIONS_VERSION=2.1.3
_OFUNCTIONS_BUILD=2017052604 _OFUNCTIONS_BUILD=2017052605
#### _OFUNCTIONS_BOOTSTRAP SUBSET #### #### _OFUNCTIONS_BOOTSTRAP SUBSET ####
_OFUNCTIONS_BOOTSTRAP=true _OFUNCTIONS_BOOTSTRAP=true
#### _OFUNCTIONS_BOOTSTRAP SUBSET END #### #### _OFUNCTIONS_BOOTSTRAP SUBSET END ####
@ -1179,9 +1179,6 @@ function GetLocalOS {
exit 1 exit 1
;; ;;
esac esac
if [ "$_OFUNCTIONS_VERSION" != "" ]; then
Logger "Local OS: [$localOsVar]." "DEBUG"
fi
# Get linux versions # Get linux versions
if [ -f "/etc/os-release" ]; then if [ -f "/etc/os-release" ]; then
@ -1191,6 +1188,10 @@ function GetLocalOS {
# Add a global variable for statistics in installer # Add a global variable for statistics in installer
LOCAL_OS_FULL="$localOsVar ($localOsName $localOsVer)" LOCAL_OS_FULL="$localOsVar ($localOsName $localOsVer)"
if [ "$_OFUNCTIONS_VERSION" != "" ]; then
Logger "Local OS: [$LOCAL_OS_FULL]." "DEBUG"
fi
} }
#### GetLocalOS SUBSET END #### #### 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 $SSH_CMD env _REMOTE_TOKEN="$_REMOTE_TOKEN" bash -s << 'ENDSSH' >> "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" 2>&1
function GetOs { function GetOs {
local localOsVar local localOsVar
local localOsName local localOsName
local localOsVer local localOsVer
local osInfo="/etc/os-release"
# 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"
@ -1286,9 +1290,11 @@ function GetOs {
fi fi
fi fi
# Get linux versions # Get linux versions
if [ -f "/etc/os-release" ]; then if [ -f "$osInfo" ]; then
localOsName=$(GetConfFileValue "/etc/os-release" "NAME") localOsName=$(grep "^NAME=" "$osInfo")
localOsVer=$(GetConfFileValue "/etc/os-release" "VERSION") localOsName="${localOsName##*=}"
localOsVer=$(grep "^VERSION=" "$osInfo")
localOsVer="${localOsVer##*=}"
fi fi
echo "$localOsVar ($localOsName $localOsVer)" echo "$localOsVar ($localOsName $localOsVer)"