diff --git a/dev/debug_osync.sh b/dev/debug_osync.sh index 695d1f8..1aa2e16 100755 --- a/dev/debug_osync.sh +++ b/dev/debug_osync.sh @@ -40,8 +40,8 @@ IS_STABLE=yes # CleanUp no #__WITH_PARANOIA_DEBUG -_OFUNCTIONS_VERSION=2.1.2 -_OFUNCTIONS_BUILD=2017052604 +_OFUNCTIONS_VERSION=2.1.3 +_OFUNCTIONS_BUILD=2017052605 _OFUNCTIONS_BOOTSTRAP=true ## BEGIN Generic bash functions written in 2013-2017 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr @@ -1198,9 +1198,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 @@ -1210,6 +1207,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 } #__BEGIN_WITH_PARANOIA_DEBUG @@ -1280,11 +1281,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" @@ -1303,9 +1307,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)" diff --git a/install.sh b/install.sh index b650720..7169863 100755 --- a/install.sh +++ b/install.sh @@ -148,9 +148,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 @@ -160,6 +157,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 } function GetConfFileValue () { local file="${1}" diff --git a/osync.sh b/osync.sh index 5c63964..e0d4bd1 100755 --- a/osync.sh +++ b/osync.sh @@ -9,8 +9,8 @@ IS_STABLE=yes -_OFUNCTIONS_VERSION=2.1.2 -_OFUNCTIONS_BUILD=2017052604 +_OFUNCTIONS_VERSION=2.1.3 +_OFUNCTIONS_BUILD=2017052605 _OFUNCTIONS_BOOTSTRAP=true ## BEGIN Generic bash functions written in 2013-2017 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr @@ -1111,9 +1111,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 @@ -1123,6 +1120,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 } @@ -1137,11 +1138,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" @@ -1160,9 +1164,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)"