Re: BSDStats - What is involved ... ?
- From: Antony Mawer <fbsd-arch@xxxxxxxxx>
- Date: Mon, 28 Aug 2006 12:06:56 +1000
On 28/08/2006 11:59 AM, Marc G. Fournier wrote:
On Sun, 27 Aug 2006, Ricardo Nabinger Sanchez wrote:That would be even easier if the dropping of 2 lines was carried out
automatically. I know people lazy enough to deinstall a port if they must
do any post-config for themselves ("make deinstall" is easier than thinking
for a few seconds).
There are several things I want to work on when I get back onto a 'real network' next week ... Matt @ Dragonfly has asked for some 'network detection' code to be added, to check if there is even a network connected, before he'll add it to there base system ... and someone else suggested adding code similar to postfix's port to have *it* prompt and auto-add the appropriate lines to /etc/periodic.conf ...
That may have been me :-) Here's a patch that implements something along those lines... anyone care to review/comment on the attached patch? I've only tested it very briefly but it appears to do the desired job...
One thing that would be nice to do is to update any existing lines for the stats, rather than always adding new lines if the user answers 'y'... detecting existing lines could easily be done by sourcing the periodic.conf:
. /etc/periodic.conf
at the top of the file, but I'm not sure the preferred way on how you'd update any existng lines if changes were required... perhaps some grep/sed-foo magic? :-)
Cheers
Antony
diff -Nru bsdstats.old/Makefile bsdstats/Makefile
--- bsdstats.old/Makefile Mon Aug 28 11:46:22 2006
+++ bsdstats/Makefile Mon Aug 28 12:01:14 2006
@@ -26,5 +26,14 @@
${CP} ${FILESDIR}/300.statistics ${LOCALBASE}/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.post.mk>
diff -Nru bsdstats.old/pkg-install bsdstats/pkg-install
--- bsdstats.old/pkg-install Thu Jan 1 10:00:00 1970
+++ bsdstats/pkg-install Mon Aug 28 11:59:55 2006
@@ -0,0 +1,43 @@
+#!/bin/sh
+#
+# pkg-install : based off /usr/ports/mail/courier/files/pkg-install.in
+#
+
+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 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
+ fi
+fi
+
_______________________________________________
freebsd-arch@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "freebsd-arch-unsubscribe@xxxxxxxxxxx"
- References:
- BSDStats - What is involved ... ?
- From: Marc G. Fournier
- Re: BSDStats - What is involved ... ?
- From: Simon L. Nielsen
- Re: BSDStats - What is involved ... ?
- From: Marc G. Fournier
- Re: BSDStats - What is involved ... ?
- From: Antony Mawer
- Re: BSDStats - What is involved ... ?
- From: Ricardo Nabinger Sanchez
- Re: BSDStats - What is involved ... ?
- From: Marc G. Fournier
- BSDStats - What is involved ... ?
- Prev by Date: Re: BSDStats - What is involved ... ?
- Next by Date: Re: BSDStats - What is involved ... ?
- Previous by thread: Re: BSDStats - What is involved ... ?
- Next by thread: Re: BSDStats - What is involved ... ?
- Index(es):
Relevant Pages
|