Hello community,

here is the log from the commit of package hostinfo for openSUSE:Factory 
checked in at 2020-12-08 13:24:58
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/hostinfo (Old)
 and      /work/SRC/openSUSE:Factory/.hostinfo.new.5913 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "hostinfo"

Tue Dec  8 13:24:58 2020 rev:3 rq:853765 version:1.0.6

Changes:
--------
--- /work/SRC/openSUSE:Factory/hostinfo/hostinfo.changes        2018-03-12 
12:11:50.411219096 +0100
+++ /work/SRC/openSUSE:Factory/.hostinfo.new.5913/hostinfo.changes      
2020-12-08 13:26:04.930775591 +0100
@@ -1,0 +2,10 @@
+Mon Nov 23 16:22:47 UTC 2020 - [email protected]
+
+- Additions to version 1.0.6
+  + Only include hostinfo details in /etc/motd (bsc#1170092)
+  + Fixed CPU load average calculation (bsc#1170094)
+  + Added program and version to output
+  + Consolidated memory output
+  + Understands 3rd party packages on SLES or OpenSUSE (bsc#1170858)
+
+-------------------------------------------------------------------

Old:
----
  hostinfo-1.0.tar.gz

New:
----
  hostinfo-1.0.6.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ hostinfo.spec ++++++
--- /var/tmp/diff_new_pack.LLtpSK/_old  2020-12-08 13:26:05.326776179 +0100
+++ /var/tmp/diff_new_pack.LLtpSK/_new  2020-12-08 13:26:05.326776179 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package hostinfo
 #
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -12,17 +12,17 @@
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
 
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
 #
 
 
 Name:           hostinfo
-Version:        1.0
+Version:        1.0.6
 Release:        0
 Summary:        Gathers basic server information
-License:        GPL-2.0
+License:        GPL-2.0-only
 Group:          System/Monitoring
-Url:            https://github.com/g23guy/hostinfo
+URL:            https://github.com/g23guy/hostinfo
 Source:         %{name}-%{version}.tar.gz
 Requires:       iproute2
 Requires:       issue-generator

++++++ hostinfo-1.0.tar.gz -> hostinfo-1.0.6.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hostinfo-1.0/bin/hostinfo 
new/hostinfo-1.0.6/bin/hostinfo
--- old/hostinfo-1.0/bin/hostinfo       2018-03-10 19:06:05.420212175 +0100
+++ new/hostinfo-1.0.6/bin/hostinfo     2020-04-29 19:20:15.934325502 +0200
@@ -1,9 +1,9 @@
 #!/bin/bash
 # Description: Displays basic system information
-# Modified:    2018 Mar 10
+# Modified:    2020 Apr 29
 
 ##############################################################################
-#  Copyright (C) 2018 SUSE LLC
+#  Copyright (C) 2018-2020 SUSE LLC
 ##############################################################################
 #
 #  This program is free software; you can redistribute it and/or modify
@@ -26,7 +26,7 @@
 ##############################################################################
 # Variables
 ##############################################################################
-SVER='1.7.25'
+SVER='1.8.5'
 PAD=25
 QUIET=0
 FORMAT_OUT="%-${PAD}s %s\n"
@@ -34,11 +34,15 @@
 ISSUE_BASE='/run/issue.d'
 FILE_HOSTINFO=''
 FILE_BASE="80-hostinfo-"
+FILE_MOTD="/etc/motd"
 HOSTINFO_PID="/run/hostinfo.pid"
 ERR_MISSING_CONFIG=2
 ERR_CUSTOM_LIMIT_EXCEEDED=3
 ERR_HOSTINFO_ACTIVE=4
 SCRIPT_NAME="${0##*/}"
+PRODUCT_FILE="/etc/products.d/baseproduct"
+RELEASE_FILE='/etc/os-release'
+
 
 trap deConfigure SIGTERM
 
@@ -71,6 +75,9 @@
        echo " cpu      Show current CPU load information"
        echo " disk     Show list is storage devices and their size"
        echo ' custom <label> <value> Creates a custom entry'
+}
+
+getVersion() {
        echo
        echo " hostinfo v${SVER}"
        echo
@@ -92,10 +99,9 @@
 {
        FILE_HOSTINFO="${ISSUE_BASE}/${FILE_BASE}01-distro" 
        > $FILE_HOSTINFO
-       PRODUCT_FILE="/etc/products.d/baseproduct"
        if [[ -s $PRODUCT_FILE ]]; then
-               SUMMARY=$(grep '<summary>' /etc/products.d/baseproduct 
2>/dev/null)
-               PATCHLVL=$(grep '<patchlevel>' /etc/products.d/baseproduct 
2>/dev/null)
+               SUMMARY=$(grep '<summary>' $PRODUCT_FILE 2>/dev/null)
+               PATCHLVL=$(grep '<patchlevel>' $PRODUCT_FILE 2>/dev/null)
 
                SUMMARY=${SUMMARY#"${SUMMARY%%[![:space:]]*}"} # trim leading 
white space
                PATCHLVL=${PATCHLVL#"${PATCHLVL%%[![:space:]]*}"} 
@@ -109,7 +115,6 @@
                        printf "$FORMAT_OUT" "Distribution:" "$DIST 
SP${PATCHLVL}" >> $FILE_HOSTINFO
                fi
        else
-               RELEASE_FILE='/etc/os-release'
                PRETTY_NAME=$(cat ${RELEASE_FILE} | grep PRETTY_NAME | cut -d\= 
-f2 | tr -d '"')
                DIST=$(sed -e "s/ SP.//g" <<< $PRETTY_NAME)
                SPSTR="0"
@@ -161,7 +166,7 @@
                echo "Network ignored in $CONFIG_FILE"
                return 0
        else
-               rm -f /run/issue.d/70-[be]*conf
+               rm -f ${ISSUE_BASE}/70-[be]*conf
                > $FILE_HOSTINFO
        fi
 
@@ -268,6 +273,12 @@
        > $FILE_HOSTINFO
        UPDATES_TMP=$(mktemp /var/tmp/hostinfo-tmp.XXXXXXXXXX)
        rpm -qa --queryformat "%{INSTALLTIME}|%{VENDOR}|%{NAME}\n" | sort -nr > 
$UPDATES_TMP
+       if [[ -s $RELEASE_FILE ]]; then
+               CPEID=$(grep 'CPE_NAME' $RELEASE_FILE 2>/dev/null | cut -d\: 
-f3 2>/dev/null)
+       else
+               CPEID=''
+       fi
+
        PATCH_STRING=$(zypper --non-interactive --no-gpg-checks patch-check 
2>/dev/null | tail -1 | grep -i patches 2>/dev/null)
        LIP_EPOC=$(head -1 $UPDATES_TMP | cut -d\| -f1)
        LIP_DATE=$(date '+%c' -d @${LIP_EPOC})
@@ -287,11 +298,20 @@
                PATCH_COUNT_NEEDED='Not Registered'
                PATCH_COUNT_SECURITY='Not Registered'
        fi
-       COUNT_NVR=$(awk -F\| '{print $2}' $UPDATES_TMP | egrep -iv "^SUSE 
LLC|^SUSE Linux Enterprise|gpg-pubkey$" | wc -l)
 
        printf "$FORMAT_OUT" "Last Installed Package:" "$LIP_DATE" >> 
$FILE_HOSTINFO
        printf "$FORMAT_OUT" " Patches Needed:" "$PATCH_COUNT_NEEDED" >> 
$FILE_HOSTINFO
        printf "$FORMAT_OUT" " Security:" "$PATCH_COUNT_SECURITY" >> 
$FILE_HOSTINFO
+       case $CPEID in
+       suse)
+               COUNT_NVR=$(awk -F\| '{print $2}' $UPDATES_TMP | egrep -iv 
"^SUSE LLC|^SUSE Linux Enterprise|gpg-pubkey$" | wc -l)
+               ;;
+       opensuse)
+               COUNT_NVR=$(awk -F\| '{print $2}' $UPDATES_TMP | egrep -iv 
"^opensuse|gpg-pubkey$" | wc -l)
+               ;;
+       *)      COUNT_NVR="Unknown"
+               ;;
+       esac
        printf "$FORMAT_OUT" " 3rd Party Packages:" "$COUNT_NVR" >> 
$FILE_HOSTINFO
 }
 
@@ -303,7 +323,6 @@
                echo "Memory ignored in $CONFIG_FILE"
                return 0
        fi
-       echo "Memory" > $FILE_HOSTINFO
        if [[ -x /usr/bin/free ]]
        then
                FREE=$(free -h | grep "^Mem")
@@ -317,11 +336,13 @@
                CALC_AVAIL=${FREE_ARRAY[-1]}
                MEM_PERCENT=$(printf "%i" $(( CALC_AVAIL * 100 / CALC_TOTAL )))
 
-               printf "$FORMAT_OUT" " Total/Free/Avail:" 
"${MEM_TOTAL}/${MEM_FREE}/${MEM_AVAIL} (${MEM_PERCENT}% Avail)" >> 
$FILE_HOSTINFO
+               printf "$FORMAT_OUT" "Memory" "${MEM_PERCENT}% Available" > 
$FILE_HOSTINFO
+               printf "$FORMAT_OUT" " Total/Free/Avail:" 
"${MEM_TOTAL}/${MEM_FREE}/${MEM_AVAIL}" >> $FILE_HOSTINFO
        else
                MEM_TOTAL=$(cat /proc/meminfo | grep MemTotal: | awk '{printf 
"%i", $2/1024}')
                MEM_FREE=$(cat /proc/meminfo | grep MemFree: | awk '{printf 
"%i", $2/1024}')
 
+               echo "Memory" > $FILE_HOSTINFO
                printf "$FORMAT_OUT" " Total/Free:" "${MEM_TOTAL}/${MEM_FREE} 
MB" >> $FILE_HOSTINFO
        fi
 }
@@ -351,10 +372,15 @@
                return 0
        fi
        CPU_COUNT=$(grep '^processor' /proc/cpuinfo 2>/dev/null | wc -l)
-       UP_TIME=($(uptime))
-       SUM=$(expr ${UP_TIME[-3]//[.,]/} + ${UP_TIME[-2]//[.,]/} + 
${UP_TIME[-1]//[.,]/})
-       AVG=$(( SUM / 3 ))
-       PERCENT=$(( AVG / CPU_COUNT ))
+       UP_TIME_CNT=3
+       SUM=0
+       for TIME in $(uptime | awk '{print $(NF-2), $(NF-1), $NF}' | tr -d ',')
+       do
+               THIS_TIME=$(cut -d\. -f1 <<< $TIME)
+               SUM=$(( $SUM + $THIS_TIME ))
+       done
+       AVG=$(( $SUM / $UP_TIME_CNT ))
+       PERCENT=$(( $AVG * 100 / $CPU_COUNT ))
        printf "$FORMAT_OUT" "CPU Load Average:" "$AVG (${PERCENT}%) with 
$CPU_COUNT CPUs" > $FILE_HOSTINFO
 }
 
@@ -365,7 +391,7 @@
                echo "SSH keys ignored in $CONFIG_FILE"
                return 0
        else
-               rm -f /run/issue.d/60-ssh_host_keys.conf
+               rm -f ${ISSUE_BASE}/60-ssh_host_keys.conf
                echo "SSH Host Keys" > $FILE_HOSTINFO
        fi
        for KEY_FILE in $(find /etc/ssh -name 'ssh_host_*_key' 2>/dev/null)
@@ -377,7 +403,7 @@
 }
 
 getCustom() {
-       BASE="${FILE_BASE}custom"
+       BASE="${FILE_BASE}99-custom"
        CUSTOM_LIMIT=9
        LAST=$(find $ISSUE_BASE -type f | sort | grep $BASE | tail -1)
        [[ -n "$LAST" ]] && NUM=$(awk -F- '{print $NF}' <<< $LAST) || NUM=0
@@ -401,15 +427,20 @@
 }
 
 putMOTD() {
-       cp /etc/issue /etc/motd
+       > $FILE_MOTD
+       for FILE in $(ls -1 ${ISSUE_BASE}/${FILE_BASE}* | sort)
+       do
+               cat $FILE >> $FILE_MOTD
+       done
+       echo >> $FILE_MOTD
 }
 
 deConfigure() {
-       rm -f /run/issue.d/80-hostinfo-*
-       rm -f /run/issue.d/00-OS
-       rm -f /run/issue.d/90-OS
+       rm -f ${ISSUE_BASE}/80-hostinfo-*
+       rm -f ${ISSUE_BASE}/00-OS
+       rm -f ${ISSUE_BASE}/90-OS
        /usr/sbin/issue-generator
-       > /etc/motd
+       > $FILE_MOTD
        exit 0
 }
 
@@ -427,19 +458,20 @@
 [[ -h 90-OS ]] || ln -sf ${SPACER} 90-OS
 case $OPT in
        -h|--h*|help) getHelp; cleanUp; exit ;;
-       dist*) getDate; getDistribution ;;
-       date) getDate ;;
-       host*) getDate; getHostname ;;
-       kern*) getDate; getKernel ;;
-       up*) getDate; getUpdates ;;
-       net*) getDate; getNetAddr ;;
-       mem*) getDate; getMemory ;;
-       disk*) getDate; getDisks ;;
-       cpu*) getDate; getCPULoad ;;
-       ssh*) getDate; getSSHKeys ;;
-       Uninstalled) cleanUp; deConfigure ;;
-       cust*) getCustom "$2" "$3";;
+       dist*) getVersion; getDate; getDistribution ;;
+       date) getVersion; getDate ;;
+       host*) getVersion; getDate; getHostname ;;
+       kern*) getVersion; getDate; getKernel ;;
+       up*) getVersion; getDate; getUpdates ;;
+       net*) getVersion; getDate; getNetAddr ;;
+       mem*) getVersion; getDate; getMemory ;;
+       disk*) getVersion; getDate; getDisks ;;
+       cpu*) getVersion; getDate; getCPULoad ;;
+       ssh*) getVersion; getDate; getSSHKeys ;;
+       Uninstalled) getVersion; cleanUp; deConfigure ;;
+       cust*) getVersion; getCustom "$2" "$3";;
        all)
+               getVersion
                getDistribution
                getDate
                getHostname
@@ -451,7 +483,7 @@
                getSSHKeys
                getDisks
                ;;
-       *) getHelp; cleanUp; exit ;;
+       *) getHelp; getVersion; cleanUp; exit ;;
 esac
 cleanUp
 (( INCLUDE_MOTD )) && putMOTD || :
_______________________________________________
openSUSE Commits mailing list -- [email protected]
To unsubscribe, email [email protected]
List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette
List Archives: 
https://lists.opensuse.org/archives/list/[email protected]

Reply via email to