ports/151837: [patch] sysutils/bsdstats : does honor BATCH when installed from package
Panagiotis Christias
p.christias at noc.ntua.gr
Tue Nov 2 07:50:13 UTC 2010
The following reply was made to PR ports/151837; it has been noted by GNATS.
From: Panagiotis Christias <p.christias at noc.ntua.gr>
To: bug-followup at FreeBSD.org
Cc: wen heping <wenheping at gmail.com>,
Panagiotis Christias <p.christias at noc.ntua.gr>
Subject: Re: ports/151837: [patch] sysutils/bsdstats : does honor BATCH when
installed from package
Date: Tue, 02 Nov 2010 09:43:05 +0200
This is a multi-part message in MIME format.
--------------050104040100060901020200
Content-Type: text/plain; charset=ISO-8859-7; format=flowed
Content-Transfer-Encoding: 7bit
oops, forgot an "#!/bin/sh -x", resending.
--
Panagiotis J. Christias Network Management Center
p.christias at noc.ntua.gr National Technical Univ. of Athens, GREECE
--------------050104040100060901020200
Content-Type: text/plain;
name="bsdstats.diff.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="bsdstats.diff.txt"
diff -Nur bsdstats.orig/Makefile bsdstats/Makefile
--- bsdstats.orig/Makefile 2010-08-19 06:06:13.000000000 +0300
+++ bsdstats/Makefile 2010-11-02 09:03:03.000000000 +0200
@@ -7,7 +7,7 @@
PORTNAME= bsdstats
PORTVERSION= 5.5
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= sysutils
DISTFILES=
@@ -16,21 +16,14 @@
NO_BUILD= yes
USE_RC_SUBR= bsdstats
-SUB_FILES= 300.statistics pkg-message
+SUB_LIST= SH=${SH} PKGINSTALL=${PKGINSTALL} PKGNAME=${PKGNAME}
+SUB_FILES= 300.statistics pkg-message pkg-install
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}
-.else
@PKG_PREFIX="${PREFIX}" ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
-.endif
.include <bsd.port.mk>
diff -Nur bsdstats.orig/files/pkg-install.in bsdstats/files/pkg-install.in
--- bsdstats.orig/files/pkg-install.in 1970-01-01 02:00:00.000000000 +0200
+++ bsdstats/files/pkg-install.in 2010-11-02 09:03:03.000000000 +0200
@@ -0,0 +1,103 @@
+#!/bin/sh
+#
+# pkg-install : based off ${PORTSDIR}/mail/courier/files/pkg-install.in
+#
+LOCALBASE=${LOCALBASE:=/usr/local}
+
+ask() {
+ 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}
+}
+
+yesno() {
+ 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
+}
+
+if [ ":$2" = ":POST-INSTALL" ]; then
+ if [ -n "${BATCH}" -o -n "${PACKAGE_BUILDING}" ]; then
+ if [ ":$OSVERSION" != ":" ]; then
+ echo
+ echo "To activate monthly statistics reporting in /etc/periodic.conf,"
+ echo "execute the following as root user:"
+ echo
+ echo "PKG_PREFIX=\"%%PREFIX%%\" %%SH%% %%PKGINSTALL%% %%PKGNAME%% POST-INSTALL"
+ echo
+ fi
+ exit 0
+ fi
+ 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
+ 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
+ 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
+ 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
+fi
+
diff -Nur bsdstats.orig/pkg-install bsdstats/pkg-install
--- bsdstats.orig/pkg-install 2007-12-20 06:39:11.000000000 +0200
+++ bsdstats/pkg-install 1970-01-01 02:00:00.000000000 +0200
@@ -1,92 +0,0 @@
-#!/bin/sh
-#
-# pkg-install : based off ${PORTSDIR}/mail/courier/files/pkg-install.in
-#
-LOCALBASE=${LOCALBASE:=/usr/local}
-
-ask() {
- 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}
-}
-
-yesno() {
- 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
-}
-
-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
- 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
- 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
- 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
-fi
-
--------------050104040100060901020200--
More information about the freebsd-ports-bugs
mailing list