Bug 171015 - [patch] Tidying sysutils/bsdstats
Summary: [patch] Tidying sysutils/bsdstats
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Michael Scheidell
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-25 03:00 UTC by A.J. Kehoe IV (Nanoman)
Modified: 2012-08-28 12:54 UTC (History)
0 users

See Also:


Attachments
file.diff (8.01 KB, patch)
2012-08-25 03:00 UTC, A.J. Kehoe IV (Nanoman)
no flags Details | Diff
bsdstats-update.diff.txt (8.53 KB, text/plain)
2012-08-26 00:36 UTC, A.J. Kehoe IV (Nanoman)
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description A.J. Kehoe IV (Nanoman) 2012-08-25 03:00:07 UTC
The FreeBSD port/bsdstats needs to be cleaned up a bit for legibility and usability purposes:

 - As reported by 2A <deuza at fr dot FreeBSD dot org>, the installation message given by pkg-message.in is somewhat confusing and illogical.  Thank you to 2A for the excellent recommendation.

 - The project's description, which is included in pkg-message.in, should appear in pkg-descr instead.

 - The Makefile's post-install message is redundant.

 - The default answer to each reporting question should be "yes".

 - The tests for /etc/periodic.conf and /etc/rc.conf could be a little simpler and not produce grep errors when these files don't exist.

 - The interactive prompts during installation could be written better.

Fix: I've attached a patch that updates four of the port's files:

 - Makefile
 - files/pkg-message.in
 - pkg-descr
 - pkg-install

patch -d /usr < /path/to/bsdstats-update.diff.txt

Patch attached with submission follows:
Comment 1 deuza 2012-08-25 21:07:35 UTC
Maybe you can add a FreeBSD's way for launch stats at first time :

if yesno "Would you like to run it now" ${BSDSTATS_MONTHLY_NOW}; then
	${PKG_PREFIX}/etc/periodic/monthly/300.statistics -nodelay
fi

by

if yesno "Would you like to run it now" ${BSDSTATS_MONTHLY_NOW}; then
	${PKG_PREFIX}/etc/rc.d/bsdstats start
fi

Regards,
2A
Comment 2 A.J. Kehoe IV (Nanoman) 2012-08-26 00:36:47 UTC
AUDEBERT Alain wrote:
>Maybe you can add a FreeBSD's way for launch stats at first time :
>
>if yesno "Would you like to run it now" ${BSDSTATS_MONTHLY_NOW}; then
>	${PKG_PREFIX}/etc/periodic/monthly/300.statistics -nodelay
>fi
>
>by
>
>if yesno "Would you like to run it now" ${BSDSTATS_MONTHLY_NOW}; then
>	${PKG_PREFIX}/etc/rc.d/bsdstats start
>fi
>
>Regards,
>2A

This only works if BSDstats is enabled in /etc/rc.conf.  Good idea, though!

Taking another look at this, I see that the "Would you like to run it
now?" prompt appears only during the process of setting up
/etc/periodic.conf.  This prompt should appear regardless of whether or
not /etc/periodic.conf or /etc/rc.conf have been configured.

I've attached my revised patch.  Please disregard the previous patch.
Comment 3 Michael Scheidell freebsd_committer freebsd_triage 2012-08-28 04:53:13 UTC
Responsible Changed
From-To: freebsd-ports-bugs->scheidell

I'll take it.
Comment 4 dfilter service freebsd_committer freebsd_triage 2012-08-28 05:03:06 UTC
Author: scheidell
Date: Tue Aug 28 04:02:55 2012
New Revision: 303269
URL: http://svn.freebsd.org/changeset/ports/303269

Log:
  - Rewrite installation message [1]
  - Include project's description in pkg-desc, not pkg-message.in
  - Change default answer to each reporting question to yes
  - Fix tests for /etc/periodic.conf and /etc/rc.conf
  - Clean up interactive prompts during installation
  - Bump PORTREVISION
  
  PR:		ports/171015
  Submitted by:	bsdstats@nanoman.ca (maintainer)
  Reported by:	2A <deuza at fr dot FreeBSD dot org> [1]

Modified:
  head/sysutils/bsdstats/Makefile
  head/sysutils/bsdstats/files/pkg-message.in
  head/sysutils/bsdstats/pkg-descr
  head/sysutils/bsdstats/pkg-install

Modified: head/sysutils/bsdstats/Makefile
==============================================================================
--- head/sysutils/bsdstats/Makefile	Tue Aug 28 01:38:50 2012	(r303268)
+++ head/sysutils/bsdstats/Makefile	Tue Aug 28 04:02:55 2012	(r303269)
@@ -7,7 +7,7 @@
 
 PORTNAME=	bsdstats
 PORTVERSION=	5.5
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	sysutils
 DISTFILES=
 
@@ -22,13 +22,8 @@ do-install:
 	${MKDIR} ${PREFIX}/etc/periodic/monthly
 	${INSTALL_SCRIPT} ${WRKDIR}/300.statistics ${PREFIX}/etc/periodic/monthly
 post-install:
-	@${CAT} ${PKGMESSAGE}
 .if defined(BATCH) || defined(PACKAGE_BUILDING)
-	@${ECHO_MSG} "	To activate monthly statistics reporting in /etc/periodic.conf,"
-	@${ECHO_MSG} "	execute the following as root user:"
-	@${ECHO_MSG}
-	@${ECHO_MSG} "PKG_PREFIX=\"${PREFIX}\" ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL"
-	@${ECHO_MSG}
+	@${CAT} ${PKGMESSAGE}
 .else
 	@PKG_PREFIX="${PREFIX}" ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
 .endif

Modified: head/sysutils/bsdstats/files/pkg-message.in
==============================================================================
--- head/sysutils/bsdstats/files/pkg-message.in	Tue Aug 28 01:38:50 2012	(r303268)
+++ head/sysutils/bsdstats/files/pkg-message.in	Tue Aug 28 04:02:55 2012	(r303269)
@@ -1,30 +1,15 @@
-
-This script, meant to be run monthly, submits statistics anonymously
-to a central checkin server (http://bsdstats.org), in an attempt to
-generate reasonably accurate demographics of both *BSD usage, as well
-as devices in use.
-
-Steps have been taken to make eliminate security concerns brought up
-in earlier releases of this, including, but not limited to, not storing
-anything in the database that has been deemed as 'sensitive' (ie. IP of
-the reporting server, and hostname).
-
 ********************
-To enable monthly reporting, edit or create /etc/periodic.conf and add this line:
+To enable monthly reporting, add these lines to /etc/periodic.conf:
 	monthly_statistics_enable="YES"
-
-To enable boottime reporting, edit or create /etc/rc.conf and add this line:
-	bsdstats_enable="YES"
-
-To enable device reporting, add this line:
 	monthly_statistics_report_devices="YES"
-
-To enable ports reporting, add this line:
 	monthly_statistics_report_ports="YES"
 
-To run it manually the first time, just run it as:
+To enable reporting on bootup, add this line to /etc/rc.conf:
+	bsdstats_enable="YES"
+
+To run it manually the first time:
 	%%PREFIX%%/etc/periodic/monthly/300.statistics -nodelay
 
 To view current statistics, go to:
-        http://www.bsdstats.org
+	http://www.bsdstats.org/
 ********************

Modified: head/sysutils/bsdstats/pkg-descr
==============================================================================
--- head/sysutils/bsdstats/pkg-descr	Tue Aug 28 01:38:50 2012	(r303268)
+++ head/sysutils/bsdstats/pkg-descr	Tue Aug 28 04:02:55 2012	(r303269)
@@ -1,8 +1,15 @@
-The purpose of this port is to attempt to produce reasonably accurate
-statistics on FreeBSD deployment, to be used for both marketing, and 
-advocacy purposes by the project.
+BSDstats is an attempt to produce reasonably accurate statistics on
+deployments of BSD operating systems.  This is useful for marketing,
+project advocacy, hardware vendors and purchasers, device driver
+maintainers, and port maintainers.
 
 The major problem that we are trying to address is vendors who do not
-feel that FreeBSD presents enough of a market to bother supporting.
+feel that BSD operating systems present enough of a market to bother
+supporting.
+
+Meant to be run monthly or during bootup, this script submits
+statistics anonymously to a central server (http://bsdstats.org).
+Potentially sensitive details like IP addresses and hostnames are not
+stored by or relayed through the BSDstats server.
 
 WWW: http://www.bsdstats.org/

Modified: head/sysutils/bsdstats/pkg-install
==============================================================================
--- head/sysutils/bsdstats/pkg-install	Tue Aug 28 01:38:50 2012	(r303268)
+++ head/sysutils/bsdstats/pkg-install	Tue Aug 28 04:02:55 2012	(r303269)
@@ -3,30 +3,30 @@
 # pkg-install : based off ${PORTSDIR}/mail/courier/files/pkg-install.in
 #
 
-# The default answer to "Would you like to activate monthly reporting in
-# /etc/periodic.conf?" is "no", which you can override by setting the
-# BSDSTATS_MONTHLY_ENABLE environment variable to "yes".
+# The default answer to "Would you like to enable monthly reporting in
+# /etc/periodic.conf?" is "yes", which you can override by setting the
+# BSDSTATS_MONTHLY_ENABLE environment variable to "no".
 #
 # The default answer to "Would you like to send a list of installed hardware
-# as well?" is "no", which you can override by setting the
-# BSDSTATS_MONTHLY_DEVICES environment variable to "yes".
+# as well?" is "yes", which you can override by setting the
+# BSDSTATS_MONTHLY_DEVICES environment variable to "no".
 #
 # The default answer to "Would you like to send a list of installed ports as
-# well?" is "no", which you can override by setting the BSDSTATS_MONTHLY_PORTS
-# environment variable to "yes".
+# well?" is "yes", which you can override by setting the BSDSTATS_MONTHLY_PORTS
+# environment variable to "no".
 #
 # The default answer to "Would you like to run it now?" is "yes", which you can
 # override by setting the BSDSTATS_MONTHLY_NOW environment variable to "no".
 #
-# The default answer to "Would you like to activate reporting on reboot in
-# /etc/rc.conf?" is "no", which you can override by setting the
-# BSDSTATS_REBOOT_REPORTING environment variable to "yes".
-
-BSDSTATS_MONTHLY_ENABLE=${BSDSTATS_MONTHLY_ENABLE:=no}
-BSDSTATS_MONTHLY_DEVICES=${BSDSTATS_MONTHLY_DEVICES:=no}
-BSDSTATS_MONTHLY_PORTS=${BSDSTATS_MONTHLY_PORTS:=no}
+# The default answer to "Would you like to enable reporting on bootup in
+# /etc/rc.conf?" is "yes", which you can override by setting the
+# BSDSTATS_REBOOT_REPORTING environment variable to "no".
+
+BSDSTATS_MONTHLY_ENABLE=${BSDSTATS_MONTHLY_ENABLE:=yes}
+BSDSTATS_MONTHLY_DEVICES=${BSDSTATS_MONTHLY_DEVICES:=yes}
+BSDSTATS_MONTHLY_PORTS=${BSDSTATS_MONTHLY_PORTS:=yes}
 BSDSTATS_MONTHLY_NOW=${BSDSTATS_MONTHLY_NOW:=yes}
-BSDSTATS_REBOOT_REPORTING=${BSDSTATS_REBOOT_REPORTING:=no}
+BSDSTATS_REBOOT_REPORTING=${BSDSTATS_REBOOT_REPORTING:=yes}
 
 ask() {
     local question default answer
@@ -58,8 +58,8 @@ yesno() {
 }
 
 if [ "$2" = "POST-INSTALL" ]; then
-    if [ -f "/etc/periodic.conf" -a -z "`grep monthly_statistics /etc/periodic.conf`" ] || [ ! -f "/etc/periodic.conf" ]; then
-        if yesno "Would you like to activate monthly reporting in /etc/periodic.conf" ${BSDSTATS_MONTHLY_ENABLE}; then
+    if [ ! -f "/etc/periodic.conf" ] || [ -z "`grep monthly_statistics /etc/periodic.conf`" ]; then
+        if yesno "Would you like to enable monthly reporting in /etc/periodic.conf" ${BSDSTATS_MONTHLY_ENABLE}; then
             echo "monthly_statistics_enable=\"YES\"" >> /etc/periodic.conf
             if yesno "Would you like to send a list of installed hardware as well" ${BSDSTATS_MONTHLY_DEVICES}; then
                 echo "monthly_statistics_report_devices=\"YES\"" >> /etc/periodic.conf
@@ -72,15 +72,14 @@ if [ "$2" = "POST-INSTALL" ]; then
             fi
         fi
     fi
-    if [ -f "/etc/rc.conf" -a -z "`grep bsdstats_enable /etc/rc.conf`" ] || [ ! -f "/etc/rc.conf" ]; then
+    if [ ! -f "/etc/rc.conf" ] || [ -z "`grep bsdstats_enable /etc/rc.conf`" ]; then
         echo ""
-        echo "If running as a desktop, or on a laptop, it is recommended that you"
-        echo "enable bsdstats within /etc/rc.conf, so that it will run on reboot."
+        echo "If you're installing BSDstats on a system that won't always be on, such as a"
+        echo "desktop or a laptop, it is recommended that you enable it in /etc/rc.conf so"
+        echo "that it will run on bootup.  This will ensure that, even if your computer is"
+        echo "off when \"monthly\" runs, your computer will be counted properly."
         echo ""
-        echo "This will ensure that even if your computer is off when monthly runs,"
-        echo "your computer will be properly counted."
-        echo ""
-        if yesno "Would you like to activate reporting on reboot in /etc/rc.conf" ${BSDSTATS_REBOOT_REPORTING}; then
+        if yesno "Would you like to enable reporting on bootup in /etc/rc.conf" ${BSDSTATS_REBOOT_REPORTING}; then
             echo "bsdstats_enable=\"YES\"" >> /etc/rc.conf
         fi
     fi
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 5 Michael Scheidell freebsd_committer freebsd_triage 2012-08-28 12:54:39 UTC
State Changed
From-To: open->closed

Committed, with minor changes. Thanks!