From owner-freebsd-ports-bugs@FreeBSD.ORG Wed Dec 21 20:50:10 2011 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E74351065749 for ; Wed, 21 Dec 2011 20:50:10 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 2B7A28FC14 for ; Wed, 21 Dec 2011 20:50:09 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id pBLKo9Nq002671 for ; Wed, 21 Dec 2011 20:50:09 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id pBLKo8SI002670; Wed, 21 Dec 2011 20:50:08 GMT (envelope-from gnats) Resent-Date: Wed, 21 Dec 2011 20:50:08 GMT Resent-Message-Id: <201112212050.pBLKo8SI002670@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, "A.J. Kehoe IV (Nanoman)" <4JT9aHfQ@nanoman.ca> Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8CA6210657EE for ; Wed, 21 Dec 2011 20:43:03 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 76FD88FC15 for ; Wed, 21 Dec 2011 20:43:03 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id pBLKh3gl017214 for ; Wed, 21 Dec 2011 20:43:03 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id pBLKh30C017202; Wed, 21 Dec 2011 20:43:03 GMT (envelope-from nobody) Message-Id: <201112212043.pBLKh30C017202@red.freebsd.org> Date: Wed, 21 Dec 2011 20:43:03 GMT From: "A.J. Kehoe IV (Nanoman)" <4JT9aHfQ@nanoman.ca> To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: ports/163516: FreeBSD Port sysutils/bsdstats Defaults Override Patch X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2011 20:50:11 -0000 >Number: 163516 >Category: ports >Synopsis: FreeBSD Port sysutils/bsdstats Defaults Override Patch >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Wed Dec 21 20:50:08 UTC 2011 >Closed-Date: >Last-Modified: >Originator: A.J. Kehoe IV (Nanoman) >Release: 8.2 >Organization: Nanoman's Company >Environment: FreeBSD localhost 8.2-RELEASE-p3 FreeBSD 8.2-RELEASE-p3 #0: Tue Sep 27 18:07:27 UTC 2011 root@i386-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC i386 >Description: Installing the FreeBSD port sysutils/bsdstats requires user interaction to answer questions about whether or not to enable monthly reporting, reporting on reboot, et cetera. The default options will be used if the PACKAGE_BUILDING environment variable is defined, but there are currently no environment variables to override the default options. >How-To-Repeat: cd /usr/ports/sysutils/bsdstats PACKAGE_BUILDING="yes" make install >Fix: I've attached a patch for the pkg-install file that allows you to override the default options with the following environment variables: - BSDSTATS_MONTHLY_ENABLE for "Would you like to activate monthly reporting in /etc/periodic.conf?", which is set to "no" by default - BSDSTATS_MONTHLY_DEVICES for "Would you like to send a list of installed hardware as well?", which is set to "no" by default - BSDSTATS_MONTHLY_PORTS for "Would you like to send a list of installed ports as well?", which is set to "no" by default - BSDSTATS_MONTHLY_NOW for "Would you like to run it now?", which is set to "yes" by default - BSDSTATS_REBOOT_REPORTING for "Would you like to activate reporting on reboot in /etc/rc.conf?", which is set to "no" by default This patch also simplifies the pkg-install file a little. Patch attached with submission follows: --- ports/sysutils/bsdstats/pkg-install.old 2007-12-19 23:39:11.000000000 -0500 +++ ports/sysutils/bsdstats/pkg-install 2011-12-21 15:31:41.000000000 -0500 @@ -2,7 +2,31 @@ # # pkg-install : based off ${PORTSDIR}/mail/courier/files/pkg-install.in # -LOCALBASE=${LOCALBASE:=/usr/local} + +# 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 send a list of installed hardware +# as well?" is "no", which you can override by setting the +# BSDSTATS_MONTHLY_DEVICES environment variable to "yes". +# +# 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". +# +# 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} +BSDSTATS_MONTHLY_NOW=${BSDSTATS_MONTHLY_NOW:=yes} +BSDSTATS_REBOOT_REPORTING=${BSDSTATS_REBOOT_REPORTING:=no} ask() { local question default answer @@ -33,50 +57,22 @@ done } -if [ ":$2" = ":POST-INSTALL" ]; then - if [ -f "/etc/periodic.conf" ]; then - if [ `grep monthly_statistics /etc/periodic.conf | wc -l` = 0 ]; then - if yesno "Would you like to activate monthly reporting in /etc/periodic.conf" n; then - echo "monthly_statistics_enable=\"YES\"" >> /etc/periodic.conf - if yesno "Would you like to send a list of installed hardware as well" n; then - echo "monthly_statistics_report_devices=\"YES\"" >> /etc/periodic.conf - fi - if yesno "Would you like to send a list of installed ports as well" n; then - echo "monthly_statistics_report_ports=\"YES\"" >> /etc/periodic.conf - fi - if yesno "Would you like to run it now" y; then - ${PKG_PREFIX}/etc/periodic/monthly/300.statistics -nodelay - fi - fi - fi - elif [ ! -f "/etc/periodic.conf" ]; then - if yesno "Would you like to activate monthly reporting in /etc/periodic.conf" n; then +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 echo "monthly_statistics_enable=\"YES\"" >> /etc/periodic.conf - if yesno "Would you like to send a list of installed hardware as well" n; then + 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 fi - if yesno "Would you like to send a list of installed ports as well" n; then + if yesno "Would you like to send a list of installed ports as well" ${BSDSTATS_MONTHLY_PORTS}; then echo "monthly_statistics_report_ports=\"YES\"" >> /etc/periodic.conf fi - if yesno "Would you like to run it now" y; then + if yesno "Would you like to run it now" ${BSDSTATS_MONTHLY_NOW}; then ${PKG_PREFIX}/etc/periodic/monthly/300.statistics -nodelay fi fi fi - if [ -f "/etc/rc.conf" ]; then - if [ `grep bsdstats_enable /etc/rc.conf | wc -l` = 0 ]; 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 "" - 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" n; then - echo "bsdstats_enable=\"YES\"" >> /etc/rc.conf - fi - fi - elif [ ! -f "/etc/rc.conf" ]; then + if [ -f "/etc/rc.conf" -a -z "`grep bsdstats_enable /etc/rc.conf`" ] || [ ! -f "/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." @@ -84,7 +80,7 @@ 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" n; then + if yesno "Would you like to activate reporting on reboot in /etc/rc.conf" ${BSDSTATS_REBOOT_REPORTING}; then echo "bsdstats_enable=\"YES\"" >> /etc/rc.conf fi fi >Release-Note: >Audit-Trail: >Unformatted: