Bug 175879 - fail non-interactive installation sysutils/bsdstats
Summary: fail non-interactive installation 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: Lars Engels
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-06 10:10 UTC by admin
Modified: 2014-01-08 19:40 UTC (History)
0 users

See Also:


Attachments
bsdstats-patch.shar (4.29 KB, application/octet-stream)
2013-11-11 20:56 UTC, A.J. Kehoe IV (Nanoman)
no flags Details
bsdstats.patch (7.64 KB, patch)
2014-01-05 20:38 UTC, Lars Engels
no flags Details | Diff
smime.p7s (3.83 KB, application/x-pkcs7-signature)
2014-01-06 20:05 UTC, nanoman
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description admin 2013-02-06 10:10:01 UTC
srv0# setenv BATCH yes
srv0# pkg install -y bsdstats-5.5_3
Updating repository catalogue
Repository catalogue is up-to-date, no need to fetch fresh copy
The following packages will be installed:

        Installing bsdstats: 5.5_3

The installation will require 13 kB more space

6 kB to be downloaded
pkg: cached package bsdstats-5.5_3: checksum mismatch, fetching from remote
bsdstats-5.5_3.txz                                                                                                                      100% 6856     6.7KB/s   6.7KB/s   00:00    
Checking integrity... done
Installing bsdstats-5.5_3...
If you're installing BSDstats on a system that won't always be on, such as a
desktop or a laptop, it is recommended that you enable it in /etc/rc.conf so
that it will run on bootup.  This will ensure that, even if your computer is
off when "monthly" runs, your computer will be counted properly.

Would you like to enable reporting on bootup in /etc/rc.conf [yes]? ^C
srv0#

with pkg_add - same behavior.

How-To-Repeat: pkg_add or pkg install bsdstats
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2013-02-06 10:10:10 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback (via the GNATS Auto Assign Tool)
Comment 2 Edwin Groothuis freebsd_committer freebsd_triage 2013-02-06 10:10:10 UTC
Maintainer of sysutils/bsdstats,

Please note that PR ports/175879 has just been submitted.

If it contains a patch for an upgrade, an enhancement or a bug fix
you agree on, reply to this email stating that you approve the patch
and a committer will take care of it.

The full text of the PR can be found at:
    http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/175879

-- 
Edwin Groothuis via the GNATS Auto Assign Tool
edwin@FreeBSD.org
Comment 3 Po-Chien Lin freebsd_committer freebsd_triage 2013-02-25 12:54:13 UTC
Responsible Changed
From-To: freebsd-ports-bugs->pclin

I'll take it.
Comment 4 Chris Rees 2013-02-25 12:59:33 UTC
Marking this INTERACTIVE would be OK, but this behaviour usually isn't
tolerated in ports; they shouldn't modify or offer to modify config files
on install.

Chris
Comment 5 admin 2013-06-16 20:38:29 UTC
so, four month no maintainer, no resolution about it bug? =)

 > Would you like to enable reporting on bootup in /etc/rc.conf [yes]? ^C
I say "no" always. Do not need "interactive" this port, do not need 
enable it by default - if no internet, it's freeze to big time on boot
Comment 6 admin 2013-07-11 06:32:32 UTC
over the past six months, no one was able to fix one line?
Comment 7 A.J. Kehoe IV (Nanoman) 2013-11-11 20:56:53 UTC
Alex Keda wrote:

[...]

>>Synopsis:       fail non-interactive installation sysutils/bsdstats

[...]

I saw the "I'll take it." response, and assumed that this had been
resolved long ago.  My apologies to everyone who had been kept waiting.

I've attached a patch that fixes this bug, cleans up pkg-install, and
updates PORTREVISION.

Alex, you can install BSDstats with everything set to "no" by declaring:

BSDSTATS_MONTHLY_ENABLE=no
BSDSTATS_REBOOT_REPORTING=no

Thank you to Alex Keda for submitting this bug report, and to 2A for the
reminder.  Sorry again to everyone for the extreme delay.
Comment 8 Dan Langille 2013-12-11 16:01:12 UTC
I'm now getting bitten by this bug.

I am unable to install bsdstats unattended, using automated 
configuration tools.

The patch works for me. Can it be commmitted please?  Results here:

[root@salt-test:~/ports/bsdstats] # grep BATCH *
Makefile:.if defined(BATCH) || defined(PACKAGE_BUILDING)
pkg-install:    if [ -z "$BATCH" -a -z "$PACKAGE_BUILDING" ]; then
[root@salt-test:~/ports/bsdstats] # export BATCH=yes
[root@salt-test:~/ports/bsdstats] # pkg add 
/var/ports/packages/All/bsdstats-5.5_5.txz
Installing bsdstats-5.5_5...
If you're installing BSDstats on a system that won't always be on, such 
as a
desktop or a laptop, it is recommended that you enable it in 
/etc/rc.conf so
that it will run on bootup.  This will ensure that, even if your 
computer is
off when "monthly" runs, your computer will be counted properly.

  done
********************
To enable monthly reporting, add these lines to /etc/periodic.conf:
         monthly_statistics_enable="YES"
         monthly_statistics_report_devices="YES"
         monthly_statistics_report_ports="YES"

To enable reporting on bootup, add this line to /etc/rc.conf:
         bsdstats_enable="YES"

To run it manually the first time:
         /usr/local/etc/periodic/monthly/300.statistics -nodelay

To view current statistics, go to:
         http://www.bsdstats.org/
********************
[root@salt-test:~/ports/bsdstats] #


-- 
Dan Langille - http://langille.org/
Comment 9 Dan Langille 2014-01-02 18:53:30 UTC
This PR is in feedback and is nearly 12 months old.

Commit?
-- 
Dan Langille - http://langille.org
Comment 10 Lars Engels freebsd_committer freebsd_triage 2014-01-05 18:37:47 UTC
Responsible Changed
From-To: pclin->lme

I'll take it.
Comment 11 Lars Engels 2014-01-05 20:38:38 UTC
Please take a look at this new version of the patch.
It does not automatically create /etc/rc.conf and /etc/periodic.conf 
when PACKAGE_BUILDING is set,
so poudriere doesn't exit with an error.

Unfortunately with staging it's not possible to conditionally display 
pkg-message, but I don't think
it does any harm to always display it.

If you like the patch, I can commit it.


Lars
Comment 12 nanoman 2014-01-06 20:05:26 UTC
Lars Engels wrote:
>Please take a look at this new version of the patch.
>It does not automatically create /etc/rc.conf and /etc/periodic.conf
>when PACKAGE_BUILDING is set,
>so poudriere doesn't exit with an error.


I don't use poudriere, so I didn't know that this problem existed.  Thank you for fixing it!

>Unfortunately with staging it's not possible to conditionally display
>pkg-message, but I don't think
>it does any harm to always display it.


I agree.

>If you like the patch, I can commit it.
>
>
>Lars


I like it, and I approve it for committing.  If applicable, here are the people to acknowledge:

Reported by: Alex Keda, 2A, and Dan Langille
Patched by: A.J. Kehoe and Lars Engels

Thank you, Lars!

-- 
A.J. Kehoe IV (Nanoman)     |  /"\  ASCII Ribbon Campaign
Nanoman's Company           |  \ /   - No HTML/RTF in E-mail
E-mail: nanoman@nanoman.ca  |   X    - No proprietary attachments
WWW: http://www.nanoman.ca/ |  / \   - Respect for open standards
Comment 13 dfilter service freebsd_committer freebsd_triage 2014-01-08 13:54:07 UTC
Author: lme
Date: Wed Jan  8 13:53:59 2014
New Revision: 339133
URL: http://svnweb.freebsd.org/changeset/ports/339133

Log:
  - Add DIG command to SUB_LIST, not overwrite the list
  - Use correct OSVERSION for the dig(1) / drill(1) change
  - Don't add anything to rc.conf and periodic.conf when WITH_PACKAGE_BUILDING is set to pet poudriere and tinderbox
  - Re-word pkg-message
  - Bump PORTREVISION
  
  PR:		ports/175879
  Submitted by:	Alex Keda <admin@lissyara.su>
  Approved by:	maintainer
  Reported by:	Alex Keda, 2A, and dvl
  Patched by:	A.J. Kehoe and me

Modified:
  head/sysutils/bsdstats/Makefile
  head/sysutils/bsdstats/pkg-install

Modified: head/sysutils/bsdstats/Makefile
==============================================================================
--- head/sysutils/bsdstats/Makefile	Wed Jan  8 13:51:12 2014	(r339132)
+++ head/sysutils/bsdstats/Makefile	Wed Jan  8 13:53:59 2014	(r339133)
@@ -3,7 +3,7 @@
 
 PORTNAME=	bsdstats
 PORTVERSION=	5.5
-PORTREVISION=	4
+PORTREVISION=	5
 CATEGORIES=	sysutils
 DISTFILES=
 
@@ -13,11 +13,11 @@ COMMENT=	Monthly script for reporting an
 NO_BUILD=	yes
 USE_RC_SUBR=	bsdstats
 SUB_FILES=	300.statistics pkg-message
-SUB_LIST=	DIG=${DIG}
+SUB_LIST+=	DIG=${DIG}
 
-.include <bsd.port.options.mk>
+.include <bsd.port.pre.mk>
 
-.if ${OSVERSION} >= 1000100
+.if ${OSVERSION} >= 1000500
 DIG=		drill
 .else
 DIG=		dig
@@ -28,4 +28,9 @@ do-install:
 	${INSTALL_SCRIPT} ${WRKDIR}/300.statistics \
 		${STAGEDIR}${PREFIX}/etc/periodic/monthly
 
-.include <bsd.port.mk>
+post-install:
+.if ! defined(BATCH) && ! defined(PACKAGE_BUILDING)
+	@PKG_PREFIX="${PREFIX}" ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
+.endif
+
+.include <bsd.port.post.mk>

Modified: head/sysutils/bsdstats/pkg-install
==============================================================================
--- head/sysutils/bsdstats/pkg-install	Wed Jan  8 13:51:12 2014	(r339132)
+++ head/sysutils/bsdstats/pkg-install	Wed Jan  8 13:53:59 2014	(r339133)
@@ -1,86 +1,84 @@
 #!/bin/sh
-#
 # pkg-install : based off ${PORTSDIR}/mail/courier/files/pkg-install.in
-#
 
-# 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 "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 "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 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:=yes}
+# The default answer to each of the installation questions is "yes".  You can
+# override a questions's default by setting its environment variable to "no".
+# 
+# Environment Variable      | Question
+# --------------------------+------------------------------------------------------------------
+# BSDSTATS_MONTHLY_ENABLE   | Would you like to enable monthly reporting in /etc/periodic.conf?
+# BSDSTATS_MONTHLY_DEVICES  | Would you like to send a list of installed hardware as well?
+# BSDSTATS_MONTHLY_PORTS    | Would you like to send a list of installed ports as well?
+# BSDSTATS_MONTHLY_NOW      | Would you like to run it now?
+# BSDSTATS_REBOOT_REPORTING | Would you like to enable reporting on bootup in /etc/rc.conf?
+
+if [ -n "$PACKAGE_BUILDING" ]; then
+	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:=no}
+	BSDSTATS_REBOOT_REPORTING=${BSDSTATS_REBOOT_REPORTING:=no}
+else
+	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:=yes}
+fi
 
 ask() {
-    local question default answer
+	local question default answer
 
-    question=$1
-    default=$2
-    if [ -z "${PACKAGE_BUILDING}" ]; then
-        read -p "${question} [${default}]? " answer
-    fi
-    if [ -z "${answer}" ]; then
-        answer=${default}
-    fi
-    echo ${answer}
+	question=$1
+	default=$2
+	if [ -z "$BATCH" -a -z "$PACKAGE_BUILDING" ]; then
+		read -p "$question [$default]? " answer
+	fi
+	if [ -z "$answer" ]; then
+		answer=$default
+	fi
+	echo $answer
 }
 
 yesno() {
-    local question default answer
+	local question default answer
 
-    question=$1
-    default=$2
-    while :; do
-        answer=$(ask "${question}" "${default}")
-        case "${answer}" in
-        [Yy]*)	return 0;;
-        [Nn]*)	return 1;;
-        esac
-        echo "Please answer yes or no."
-    done
+	question=$1
+	default=$2
+	while :; do
+		answer=$(ask "$question" "$default")
+		case "$answer" in
+			[Yy]*) return 0;;
+			[Nn]*) return 1;;
+		esac
+		echo "Please answer yes or no."
+	done
 }
 
 if [ "$2" = "POST-INSTALL" ]; 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
-            fi
-            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" ${BSDSTATS_MONTHLY_NOW}; then
-               ${PKG_PREFIX}/etc/periodic/monthly/300.statistics -nodelay
-            fi
-        fi
-    fi
-    if [ ! -f "/etc/rc.conf" ] || [ -z "`grep bsdstats_enable /etc/rc.conf`" ]; then
-        echo ""
-        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 ""
-        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
+	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
+			fi
+			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" $BSDSTATS_MONTHLY_NOW; then
+				${PKG_PREFIX}/etc/periodic/monthly/300.statistics -nodelay
+			fi
+		fi
+	fi
+	if [ ! -f "/etc/rc.conf" ] || [ -z "`grep bsdstats_enable /etc/rc.conf`" ]; then
+		echo
+		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
+		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
 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 14 Lars Engels freebsd_committer freebsd_triage 2014-01-08 13:55:04 UTC
State Changed
From-To: feedback->closed

Last patch committed in agreement with maintainer.
Comment 15 dfilter service freebsd_committer freebsd_triage 2014-01-08 19:30:45 UTC
Author: lme
Date: Wed Jan  8 19:30:37 2014
New Revision: 339166
URL: http://svnweb.freebsd.org/changeset/ports/339166

Log:
  MFH: r339133
  
  - Add DIG command to SUB_LIST, not overwrite the list
  - Use correct OSVERSION for the dig(1) / drill(1) change
  - Don't add anything to rc.conf and periodic.conf when WITH_PACKAGE_BUILDING is set to pet poudriere and tinderbox
  - Re-word pkg-message
  - Bump PORTREVISION
  
  PR:		ports/175879
  Submitted by:	Alex Keda <admin@lissyara.su>
  Approved by:	maintainer
  Reported by:	Alex Keda, 2A, and dvl
  Patched by:	A.J. Kehoe and me
  Approved by:	portmgr (bapt)

Modified:
  branches/2014Q1/sysutils/bsdstats/Makefile
  branches/2014Q1/sysutils/bsdstats/pkg-install
Directory Properties:
  branches/2014Q1/   (props changed)

Modified: branches/2014Q1/sysutils/bsdstats/Makefile
==============================================================================
--- branches/2014Q1/sysutils/bsdstats/Makefile	Wed Jan  8 19:19:53 2014	(r339165)
+++ branches/2014Q1/sysutils/bsdstats/Makefile	Wed Jan  8 19:30:37 2014	(r339166)
@@ -3,7 +3,7 @@
 
 PORTNAME=	bsdstats
 PORTVERSION=	5.5
-PORTREVISION=	4
+PORTREVISION=	5
 CATEGORIES=	sysutils
 DISTFILES=
 
@@ -13,11 +13,11 @@ COMMENT=	Monthly script for reporting an
 NO_BUILD=	yes
 USE_RC_SUBR=	bsdstats
 SUB_FILES=	300.statistics pkg-message
-SUB_LIST=	DIG=${DIG}
+SUB_LIST+=	DIG=${DIG}
 
-.include <bsd.port.options.mk>
+.include <bsd.port.pre.mk>
 
-.if ${OSVERSION} >= 1000100
+.if ${OSVERSION} >= 1000500
 DIG=		drill
 .else
 DIG=		dig
@@ -28,4 +28,9 @@ do-install:
 	${INSTALL_SCRIPT} ${WRKDIR}/300.statistics \
 		${STAGEDIR}${PREFIX}/etc/periodic/monthly
 
-.include <bsd.port.mk>
+post-install:
+.if ! defined(BATCH) && ! defined(PACKAGE_BUILDING)
+	@PKG_PREFIX="${PREFIX}" ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
+.endif
+
+.include <bsd.port.post.mk>

Modified: branches/2014Q1/sysutils/bsdstats/pkg-install
==============================================================================
--- branches/2014Q1/sysutils/bsdstats/pkg-install	Wed Jan  8 19:19:53 2014	(r339165)
+++ branches/2014Q1/sysutils/bsdstats/pkg-install	Wed Jan  8 19:30:37 2014	(r339166)
@@ -1,86 +1,84 @@
 #!/bin/sh
-#
 # pkg-install : based off ${PORTSDIR}/mail/courier/files/pkg-install.in
-#
 
-# 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 "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 "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 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:=yes}
+# The default answer to each of the installation questions is "yes".  You can
+# override a questions's default by setting its environment variable to "no".
+# 
+# Environment Variable      | Question
+# --------------------------+------------------------------------------------------------------
+# BSDSTATS_MONTHLY_ENABLE   | Would you like to enable monthly reporting in /etc/periodic.conf?
+# BSDSTATS_MONTHLY_DEVICES  | Would you like to send a list of installed hardware as well?
+# BSDSTATS_MONTHLY_PORTS    | Would you like to send a list of installed ports as well?
+# BSDSTATS_MONTHLY_NOW      | Would you like to run it now?
+# BSDSTATS_REBOOT_REPORTING | Would you like to enable reporting on bootup in /etc/rc.conf?
+
+if [ -n "$PACKAGE_BUILDING" ]; then
+	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:=no}
+	BSDSTATS_REBOOT_REPORTING=${BSDSTATS_REBOOT_REPORTING:=no}
+else
+	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:=yes}
+fi
 
 ask() {
-    local question default answer
+	local question default answer
 
-    question=$1
-    default=$2
-    if [ -z "${PACKAGE_BUILDING}" ]; then
-        read -p "${question} [${default}]? " answer
-    fi
-    if [ -z "${answer}" ]; then
-        answer=${default}
-    fi
-    echo ${answer}
+	question=$1
+	default=$2
+	if [ -z "$BATCH" -a -z "$PACKAGE_BUILDING" ]; then
+		read -p "$question [$default]? " answer
+	fi
+	if [ -z "$answer" ]; then
+		answer=$default
+	fi
+	echo $answer
 }
 
 yesno() {
-    local question default answer
+	local question default answer
 
-    question=$1
-    default=$2
-    while :; do
-        answer=$(ask "${question}" "${default}")
-        case "${answer}" in
-        [Yy]*)	return 0;;
-        [Nn]*)	return 1;;
-        esac
-        echo "Please answer yes or no."
-    done
+	question=$1
+	default=$2
+	while :; do
+		answer=$(ask "$question" "$default")
+		case "$answer" in
+			[Yy]*) return 0;;
+			[Nn]*) return 1;;
+		esac
+		echo "Please answer yes or no."
+	done
 }
 
 if [ "$2" = "POST-INSTALL" ]; 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
-            fi
-            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" ${BSDSTATS_MONTHLY_NOW}; then
-               ${PKG_PREFIX}/etc/periodic/monthly/300.statistics -nodelay
-            fi
-        fi
-    fi
-    if [ ! -f "/etc/rc.conf" ] || [ -z "`grep bsdstats_enable /etc/rc.conf`" ]; then
-        echo ""
-        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 ""
-        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
+	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
+			fi
+			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" $BSDSTATS_MONTHLY_NOW; then
+				${PKG_PREFIX}/etc/periodic/monthly/300.statistics -nodelay
+			fi
+		fi
+	fi
+	if [ ! -f "/etc/rc.conf" ] || [ -z "`grep bsdstats_enable /etc/rc.conf`" ]; then
+		echo
+		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
+		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
 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"