1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-02-04 11:23:46 +00:00

Update sysutils/bsdstats to 6.2

- Fix files/300.statistics.in so that it can work with the new output
  format of pciconf -l in 13.0-CURRENT.
- Fix a bug in device reporting.
- Add support for ports reporting from MidnightBSD systems, whose ports
  tree is based on FreeBSD ports tree.
- Changes to using /usr/bin/nc on DragonFly BSD, whose ports tree is based
  on FreeBSD ports tree.
- Assume maintainership of sysutils/bsdstats. [1]

PR:		229347
Submitted by:	scrappy
Approved by:	yuri (maintainer) [1], gerald (mentor)
This commit is contained in:
Lorenzo Salvadore 2020-03-01 13:27:22 +00:00
parent 49afd2203f
commit 28397798c2
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=527552
2 changed files with 33 additions and 22 deletions

View File

@ -2,12 +2,11 @@
# $FreeBSD$
PORTNAME= bsdstats
PORTVERSION= 6.0
PORTREVISION= 2
PORTVERSION= 6.2
CATEGORIES= sysutils
DISTFILES=
MAINTAINER= yuri@FreeBSD.org
MAINTAINER= salvadore@FreeBSD.org
COMMENT= Monthly script for reporting anonymous statistics about your machine
LICENSE= BSD4CLAUSE

View File

@ -26,24 +26,12 @@ WC=/usr/bin/wc
MV=/bin/mv
RM=/bin/rm
case $(${UNAME}) in
FreeBSD)
UMASK=/usr/bin/umask
OPENSSL=/usr/bin/openssl
CHOWN=/usr/sbin/chown
NC=/usr/bin/nc
;;
OpenBSD)
UMASK=/usr/bin/umask
OPENSSL=/usr/sbin/openssl
CHOWN=/sbin/chown
NC=/usr/bin/nc
;;
DragonFly)
UMASK=/usr/bin/umask
OPENSSL=/usr/bin/openssl
CHOWN=/usr/sbin/chown
NC=/usr/local/bin/netcat
;;
NetBSD)
UMASK=umask
OPENSSL=/usr/bin/openssl
@ -351,16 +339,24 @@ setup_proxies() {
report_devices() {
case $(${UNAME}) in
FreeBSD|DragonFly)
FreeBSD|DragonFly|MidnightBSD)
local query_string=""
local line
for line in $(${PCICONF} -l); do
while read line
do
local DRIVER=$(echo "${line}" | ${AWK} -F\@ '{print $1}')
local DEV=$(echo "${line}" | ${AWK} '{print $4}' | ${CUT} -c8-15)
if [ "0`echo "${line}" | awk '{print $5}' | awk -F= '{print $1}'`" = "0vendor" ]; then
local VENDOR=$(echo "${line}" | ${AWK} '{print $5}' | ${CUT} -c10-15)
local DEVICE=$(echo "${line}" | ${AWK} '{print $6}' | ${CUT} -c10-15)
local DEV=$(echo "${DEVICE}${VENDOR}")
else
local DEV=$(echo "${line}" | ${AWK} '{print $4}' | ${CUT} -c8-15)
fi
local CLASS=$(echo "${line}" | ${AWK} '{print $2}' | ${CUT} -c9-14)
query_string=$query_string`echo \&dev[]=${DRIVER}:${DEV}:${CLASS}`
done
done << EOT
$(${PCICONF} -l)
EOT
echo_begin "Posting device statistics to ${checkin_server_description}"
do_http_request_check_status "GET" "/scripts/report_devices.php?token=${TOKEN}&key=${KEY}$query_string" \
"" "" "system devices submission"
@ -373,14 +369,30 @@ report_devices() {
esac
}
get_mports() {
for i in `/usr/libexec/mport.list | xargs`
do
pkg=$(echo "select pkg from packages where pkg || '-' || version = '$i'" | sqlite3 /var/db/mport/master.db)
echo -n "$i "
mport info $pkg | grep Origin | awk '{print $3}'
done
}
report_ports() {
case $(${UNAME}) in
FreeBSD|DragonFly)
FreeBSD|DragonFly|MidnightBSD)
local query_string=""
# Detect pkgng
if [ -e /var/db/pkg/local.sqlite ]; then
# Use pkgng
query_string="${query_string}$(pkg info -o "*" | ${SED} -E -e 's/\+/%2b/g' -e 's/,/%2c/g' -e 's/^([^ ]+) +([^\/]+)\/.+$/\&port[]=\2:\1/g' | tr -d '\n')"
case $(${UNAME}) in
MidnightBSD)
query_string="${query_string}$( get_mports | ${SED} -E -e 's/\+/%2b/g' -e 's/,/%2c/g' -e 's/^([^ ]+) +([^\/]+)\/.+$/\&port[]=\2:\1/g' | tr -d '\n')"
;;
*)
query_string="${query_string}$( pkg info -o "*" | ${SED} -E -e 's/\+/%2b/g' -e 's/,/%2c/g' -e 's/^([^ ]+) +([^\/]+)\/.+$/\&port[]=\2:\1/g' | tr -d '\n')"
;;
esac
else
#-----BEGIN LEGACY: to delete when FreeBSD with pkg_ tools is out of support period (!!! don't forget to clarify what does DragonFly use before removing !!!) -----
# Use obsolete pkg_* tools