svn commit: r533478 - in head/sysutils/bsdstats: . files
Lorenzo Salvadore
salvadore at FreeBSD.org
Thu Apr 30 23:32:19 UTC 2020
Author: salvadore
Date: Thu Apr 30 23:32:18 2020
New Revision: 533478
URL: https://svnweb.freebsd.org/changeset/ports/533478
Log:
sysutils/bsdstats: Update to 7.0
- Use pkg query %n:%v:%o instead of pkg info -o “*” to get list of
installed packages. This simplifies processing and accuracy of split for
version numbers on the report server by not having to guess where that
split is.
- Check for existence of %%PREFIX%%/etc/bsdstats.conf and if it exists,
restrict ports submitted to those listed in there.
- Add a note to pkg-message.in about %%PREFIX%%/etc/bsdstats.conf
- Get rid of the LIMITED config option: LIMITED is enabled if and only if
%%PREFIX%%/etc/bsdstats.conf exists.
While here, also modernize the port using option helpers.
Submitted by: scrappy
Approved by: gerald (mentor)
Differential Revision: https://reviews.freebsd.org/D24644
Modified:
head/sysutils/bsdstats/Makefile
head/sysutils/bsdstats/files/300.statistics.in
head/sysutils/bsdstats/files/pkg-message.in
Modified: head/sysutils/bsdstats/Makefile
==============================================================================
--- head/sysutils/bsdstats/Makefile Thu Apr 30 21:38:37 2020 (r533477)
+++ head/sysutils/bsdstats/Makefile Thu Apr 30 23:32:18 2020 (r533478)
@@ -2,7 +2,7 @@
# $FreeBSD$
PORTNAME= bsdstats
-PORTVERSION= 6.2
+PORTVERSION= 7.0
CATEGORIES= sysutils
DISTFILES=
@@ -17,28 +17,23 @@ SUB_FILES= 300.statistics bsdstats-send pkg-message
SUB_LIST+= VERSION=${PORTVERSION}
NO_ARCH= YES
-OPTIONS_DEFINE= TOR
-TOR_DESC= Submit securely through TOR anonymity network
-
PLIST_FILES= bin/bsdstats-send \
etc/periodic/monthly/300.statistics
-.include <bsd.port.pre.mk>
+OPTIONS_DEFINE= TOR
+TOR_DESC= Submit securely through TOR anonymity network
-.if ${PORT_OPTIONS:MTOR}
-RUN_DEPENDS+= tor:security/tor
-.endif
+TOR_RUN_DEPENDS= tor:security/tor
-pre-install:
-.if ${PORT_OPTIONS:MTOR}
+pre-install-TOR-on:
@${REINPLACE_CMD} -e 's|USE_TOR=NO|USE_TOR=YES|' ${WRKDIR}/300.statistics
@${REINPLACE_CMD} -e 's|# REQUIRE: LOGIN|# REQUIRE: LOGIN tor|' ${WRKDIR}/bsdstats
@${REINPLACE_CMD} -e 's|@@TOR_MESSAGE@@|Statistics will be submitted anonymously through the TOR network|' \
${WRKDIR}/pkg-message
-.else
+
+pre-install-TOR-off:
@${REINPLACE_CMD} -e 's|@@TOR_MESSAGE@@|You can build bsdstats with TOR port option to submit anonymously|' \
${WRKDIR}/pkg-message
-.endif
do-install:
${MKDIR} ${STAGEDIR}${PREFIX}/etc/periodic/monthly
@@ -47,4 +42,4 @@ do-install:
${INSTALL_SCRIPT} ${WRKDIR}/bsdstats-send \
${STAGEDIR}${PREFIX}/bin/bsdstats-send
-.include <bsd.port.post.mk>
+.include <bsd.port.mk>
Modified: head/sysutils/bsdstats/files/300.statistics.in
==============================================================================
--- head/sysutils/bsdstats/files/300.statistics.in Thu Apr 30 21:38:37 2020 (r533477)
+++ head/sysutils/bsdstats/files/300.statistics.in Thu Apr 30 23:32:18 2020 (r533478)
@@ -387,13 +387,20 @@ report_ports() {
# Use pkgng
case $(${UNAME}) in
MidnightBSD)
+ report_uri="/scripts/report_ports.php"
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')"
+ report_uri="/scripts/report_ports_v2.php"
+ if [ -f %%PREFIX%%/etc/bsdstats.conf -a "0" = "0`grep ^all-ports /usr/local/etc/bsdstats.conf`" ]; then
+ query_string=$( pkg query %n:%v:%o | fgrep -f %%PREFIX%%/etc/bsdstats.conf | awk -F\/ '{print $1}' | sed -E -e 's/\+/%2b/g' -e 's/,/%2c/g' | awk '{printf"&port[]=%s", $1}' )
+ else
+ query_string=$( pkg query %n:%v:%o | awk -F\/ '{print $1}' | sed -E -e 's/\+/%2b/g' -e 's/,/%2c/g' | awk '{printf"&port[]=%s", $1}' )
+ fi
;;
esac
else
+ report_uri="/scripts/report_ports.php"
#-----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
local line
@@ -406,7 +413,7 @@ report_ports() {
#-----END LEGACY-----
fi
echo_begin "Posting port statistics to ${checkin_server_description}"
- do_http_request_check_status "POST" "/scripts/report_ports.php" \
+ do_http_request_check_status "POST" $report_uri \
"token=${TOKEN}&key=${KEY}${query_string}" "application/x-www-form-urlencoded" "ports submission"
echo_end_success
log "INFO" "Posted port statistics to ${checkin_server_description}"
Modified: head/sysutils/bsdstats/files/pkg-message.in
==============================================================================
--- head/sysutils/bsdstats/files/pkg-message.in Thu Apr 30 21:38:37 2020 (r533477)
+++ head/sysutils/bsdstats/files/pkg-message.in Thu Apr 30 23:32:18 2020 (r533478)
@@ -1,7 +1,7 @@
[
{ type: install
message: <<EOM
-You installed BSDstats: script reporting statistics about your machine
+You installed BSDstats: script reporting statistics about your machine.
To disable monthly reporting, add this line to /etc/periodic.conf:
monthly_statistics_enable="NO"
@@ -9,6 +9,14 @@ To disable monthly reporting, add this line to /etc/pe
To disable parts of reporting, add these lines to /etc/periodic.conf:
monthly_statistics_report_devices="NO"
monthly_statistics_report_ports="NO"
+
+To limit which ports are being submitted:
+ create /usr/local/etc/bsdstats.conf and list ports to report in
+ the form ${category}/${portname}, one entry per line. It is also
+ possible to use the special self explanatory keyword "all-ports".
+Example:
+ sysutils/bsdstats
+ ports-mgmt/pkg
To enable reporting on bootup, add this line to /etc/rc.conf:
bsdstats_enable="YES"
More information about the svn-ports-all
mailing list