[Midnightbsd-cvs] mports: sysutils/bsdstats: Update bsdstats to 5.4 (equivalent to the

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Mon Jan 21 10:44:08 EST 2008


Log Message:
-----------
Update bsdstats to 5.4 (equivalent to the version in FreeBSD ports).  This new version has a rc.d script that can run on reboot in place of the monthly reporting which is very helpful for our project.

Modified Files:
--------------
    mports/sysutils/bsdstats:
        Makefile (r1.3 -> r1.4)
        pkg-install (r1.1 -> r1.2)
        pkg-message (r1.2 -> r1.3)
    mports/sysutils/bsdstats/files:
        300.statistics (r1.1 -> r1.2)

Added Files:
-----------
    mports/sysutils/bsdstats/files:
        bsdstats.sh (r1.1)

-------------- next part --------------
Index: pkg-message
===================================================================
RCS file: /home/cvs/mports/sysutils/bsdstats/pkg-message,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sysutils/bsdstats/pkg-message -L sysutils/bsdstats/pkg-message -u -r1.2 -r1.3
--- sysutils/bsdstats/pkg-message
+++ sysutils/bsdstats/pkg-message
@@ -8,9 +8,14 @@
 anything in the database that has been deemed as 'sensitive' (ie. IP of
 the reporting server, and hostname).
 
-To enable the port, edit or create /etc/periodic.conf and add this line:
+To enable monthly reporting, edit or create /etc/periodic.conf and 
+add this line:
 	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"
 
Index: pkg-install
===================================================================
RCS file: /home/cvs/mports/sysutils/bsdstats/pkg-install,v
retrieving revision 1.1
retrieving revision 1.2
diff -L sysutils/bsdstats/pkg-install -L sysutils/bsdstats/pkg-install -u -r1.1 -r1.2
--- sysutils/bsdstats/pkg-install
+++ sysutils/bsdstats/pkg-install
@@ -1,7 +1,9 @@
 #!/bin/sh
 #
-# pkg-install : based off /usr/ports/mail/courier/files/pkg-install.in
+# $MidnightBSD$
+# pkg-install : based off ${PORTSDIR}/mail/courier/files/pkg-install.in
 #
+LOCALBASE=${LOCALBASE:=/usr/local}
 
 ask() {
     local question default answer
@@ -44,7 +46,7 @@
                     echo "monthly_statistics_report_ports=\"YES\"" >> /etc/periodic.conf
                 fi
                 if yesno "Would you like to run it now" y; then
-                   /usr/local/etc/periodic/monthly/300.statistics -nodelay
+                   ${PKG_PREFIX}/etc/periodic/monthly/300.statistics -nodelay
                 fi
             fi
         fi
@@ -58,9 +60,34 @@
                 echo "monthly_statistics_report_ports=\"YES\"" >> /etc/periodic.conf
             fi
             if yesno "Would you like to run it now" y; then
-               /usr/local/etc/periodic/monthly/300.statistics -nodelay
+               ${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
 
Index: Makefile
===================================================================
RCS file: /home/cvs/mports/sysutils/bsdstats/Makefile,v
retrieving revision 1.3
retrieving revision 1.4
diff -L sysutils/bsdstats/Makefile -L sysutils/bsdstats/Makefile -u -r1.3 -r1.4
--- sysutils/bsdstats/Makefile
+++ sysutils/bsdstats/Makefile
@@ -7,7 +7,7 @@
 #
 
 PORTNAME=	bsdstats
-PORTVERSION=	5.3
+PORTVERSION=	5.4
 CATEGORIES=	sysutils
 DISTFILES=
 
@@ -18,12 +18,15 @@
 .include <bsd.port.pre.mk>
 
 NO_BUILD=	yes
-PLIST_FILES=	etc/periodic/monthly/300.statistics
+PLIST_FILES=	etc/periodic/monthly/300.statistics \
+		etc/rc.d/bsdstats.sh
 PLIST_DIRS=	etc/periodic/monthly \
 		etc/periodic
 
 do-install:
 	${MKDIR} ${PREFIX}/etc/periodic/monthly
 	${CP} ${FILESDIR}/300.statistics ${PREFIX}/etc/periodic/monthly
+	${CP} ${FILESDIR}/bsdstats.sh ${PREFIX}/etc/rc.d
+	${CHMOD} 0755 ${PREFIX}/etc/rc.d/bsdstats.sh
 
 .include <bsd.port.post.mk>
--- /dev/null
+++ sysutils/bsdstats/files/bsdstats.sh
@@ -0,0 +1,31 @@
+#!/bin/sh 
+#
+# $MidnightBSD: mports/sysutils/bsdstats/files/bsdstats.sh,v 1.1 2008/01/21 15:44:06 laffer1 Exp $
+# $FreeBSD: ports/sysutils/bsdstats/files/bsdstats.sh,v 1.1 2007/04/28 23:54:03 scrappy Exp $
+#
+
+# PROVIDE: bsdstats
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+
+# bsdstats is disabled by default, if you have configuration file
+#
+# Add the following line to /etc/rc.conf to enable bsdstats:
+#
+#bsdstats_enable="YES"
+#
+
+. /etc/rc.subr
+
+load_rc_config bsdstats
+
+name=bsdstats
+rcvar=`set_rcvar`
+
+command=/usr/local/etc/periodic/monthly/300.statistics
+
+# default to disable
+bsdstats_enable=${bsdstats_enable:-"NO"}
+bsdstats_flags=${bsdstats_flags:-"-nodelay"}
+
+run_rc_command "$1"
Index: 300.statistics
===================================================================
RCS file: /home/cvs/mports/sysutils/bsdstats/files/300.statistics,v
retrieving revision 1.1
retrieving revision 1.2
diff -L sysutils/bsdstats/files/300.statistics -L sysutils/bsdstats/files/300.statistics -u -r1.1 -r1.2
--- sysutils/bsdstats/files/300.statistics
+++ sysutils/bsdstats/files/300.statistics
@@ -23,7 +23,7 @@
 oldmask=$(umask)
 umask 066
 
-version="5.2"
+version="5.4"
 checkin_server=${monthly_statistics_checkin_server:-"rpt.bsdstats.org"}
 bsdstats_log=${monthly_statistics_logfile:-"/var/log/bsdstats"}
 id_token_file='/var/db/bsdstats'
@@ -398,7 +398,6 @@
 case "$monthly_statistics_enable" in
     [Yy][Ee][Ss])
       check_dns
-      HN=`/bin/hostname`
       REL=`/usr/bin/uname -r`
       ARCH=`/usr/bin/uname -m`
       OS=`/usr/bin/uname -s`
@@ -407,32 +406,34 @@
       enable_token
       report_system
       echo "Posting monthly OS statistics to $checkin_server"
-      case "$monthly_statistics_report_devices" in
-          [Yy][Ee][Ss])
-              send_devices
-              echo "Posting monthly device statistics to $checkin_server"
-              line=$( sysctl -n hw.model )
-              VEN=$( echo $line | cut -d ' ' -f 1 )
-              DEV=$( uri_escape $( echo $line | cut -d ' ' -f 2- ) )
-              count=$( sysctl -n hw.ncpu )
-              report_cpu
-              echo "Posting monthly CPU statistics to $checkin_server"
-             ;;
-          *) 
-             echo "Posting monthly device/CPU statistics disabled"
-             echo "    set monthly_statistics_report_devices=\"YES\" in $periodic_conf"
-             ;;
-      esac
-      case "$monthly_statistics_report_ports" in
-          [Yy][Ee][Ss])
-              send_ports
-              echo "Posting monthly ports statistics to $checkin_server"
-             ;;
-          *) 
-             echo "Posting monthly ports statistics disabled"
-             echo "    set monthly_statistics_report_ports=\"YES\" in $periodic_conf"
-             ;;
-      esac
+      if [ X"$1" != X-nodelay ]; then
+          case "$monthly_statistics_report_devices" in
+              [Yy][Ee][Ss])
+                  send_devices
+                  echo "Posting monthly device statistics to $checkin_server"
+                  line=$( sysctl -n hw.model )
+                  VEN=$( echo $line | cut -d ' ' -f 1 )
+                  DEV=$( uri_escape $( echo $line | cut -d ' ' -f 2- ) )
+                  count=$( sysctl -n hw.ncpu )
+                  report_cpu
+                  echo "Posting monthly CPU statistics to $checkin_server"
+                 ;;
+              *) 
+                 echo "Posting monthly device/CPU statistics disabled"
+                 echo "    set monthly_statistics_report_devices=\"YES\" in $periodic_conf"
+                 ;;
+          esac
+          case "$monthly_statistics_report_ports" in
+              [Yy][Ee][Ss])
+                  send_ports
+                  echo "Posting monthly ports statistics to $checkin_server"
+                 ;;
+              *) 
+                 echo "Posting monthly ports statistics disabled"
+                 echo "    set monthly_statistics_report_ports=\"YES\" in $periodic_conf"
+                 ;;
+          esac
+      fi
       disable_token
       ;;
     *) 


More information about the Midnightbsd-cvs mailing list