diff --git a/ports-mgmt/Makefile b/ports-mgmt/Makefile index 48589ad362f0..9c7757264a14 100644 --- a/ports-mgmt/Makefile +++ b/ports-mgmt/Makefile @@ -8,6 +8,7 @@ SUBDIR += bxpkg SUBDIR += distilator SUBDIR += fastest_sites + SUBDIR += fbsdmon SUBDIR += genplist SUBDIR += gnome-packagekit SUBDIR += hs-porte diff --git a/ports-mgmt/fbsdmon/Makefile b/ports-mgmt/fbsdmon/Makefile new file mode 100644 index 000000000000..a983b4c1abba --- /dev/null +++ b/ports-mgmt/fbsdmon/Makefile @@ -0,0 +1,31 @@ +# New ports collection makefile for: fbsdmon +# Date created: 21 January 2012 +# Whom: Grzegorz Blach +# +# $FreeBSD$ +# + +PORTNAME= fbsdmon +PORTVERSION= 0.90 +CATEGORIES= ports-mgmt sysutils +MASTER_SITES= http://files.roorback.net/ + +MAINTAINER= magik@roorback.net +COMMENT= Sumbit system and ports statistics to fbsdmon.org + +LIB_DEPENDS= curl.6:${PORTSDIR}/ftp/curl \ + jansson.6:${PORTSDIR}/devel/jansson \ + +SUB_FILES= 600.fbsdmon pkg-message +USE_RC_SUBR= fbsdmon + +do-install: + ${INSTALL_PROGRAM} ${WRKSRC}/fbsdmon ${PREFIX}/sbin + ${MKDIR} /var/db/fbsdmon + ${MKDIR} ${PREFIX}/etc/periodic/weekly + ${INSTALL_SCRIPT} ${WRKDIR}/600.fbsdmon ${PREFIX}/etc/periodic/weekly + +post-install: + @${CAT} ${PKGMESSAGE} + +.include diff --git a/ports-mgmt/fbsdmon/distinfo b/ports-mgmt/fbsdmon/distinfo new file mode 100644 index 000000000000..c0dfcf0c0030 --- /dev/null +++ b/ports-mgmt/fbsdmon/distinfo @@ -0,0 +1,2 @@ +SHA256 (fbsdmon-0.90.tar.gz) = 5143eb51b241bef6c30e26a5fac54308ca36db76b865da208f33edab92c13b78 +SIZE (fbsdmon-0.90.tar.gz) = 3692 diff --git a/ports-mgmt/fbsdmon/files/600.fbsdmon.in b/ports-mgmt/fbsdmon/files/600.fbsdmon.in new file mode 100644 index 000000000000..5b970f7412f0 --- /dev/null +++ b/ports-mgmt/fbsdmon/files/600.fbsdmon.in @@ -0,0 +1,25 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# If there is a global system configuration file, suck it in. +# +if [ -r /etc/defaults/periodic.conf ] +then + . /etc/defaults/periodic.conf + source_periodic_confs +fi + +case "$weekly_fbsdmon_enable" in + [Yy][Ee][Ss]) + echo "" + echo "Sending statistic to fbsdmon.org" + + %%PREFIX%%/sbin/fbsdmon + rc=$?;; + + *) rc=0;; +esac + +exit $rc diff --git a/ports-mgmt/fbsdmon/files/fbsdmon.in b/ports-mgmt/fbsdmon/files/fbsdmon.in new file mode 100644 index 000000000000..64dc73c63b74 --- /dev/null +++ b/ports-mgmt/fbsdmon/files/fbsdmon.in @@ -0,0 +1,30 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: fbsdmon +# REQUIRE: LOGIN +# KEYWORD: shutdown + +# Add the following line to /etc/rc.conf to enable `fbsdmon': +# +# fbsdmon_enable="YES" +# + + +. /etc/rc.subr + +name=fbsdmon +rcvar=fbsdmon_enable + +load_rc_config "$name" +: ${fbsdmon_enable="NO"} + +pidfile="/var/run/$name.pid" +procname="%%PREFIX%%/sbin/$name" +command="/usr/sbin/daemon" +command_args="-c -f -p $pidfile $procname" +stop_postcmd="/bin/rm -f $pidfile" + +run_rc_command "$1" diff --git a/ports-mgmt/fbsdmon/files/patch-src__io.c b/ports-mgmt/fbsdmon/files/patch-src__io.c new file mode 100644 index 000000000000..a60332c25712 --- /dev/null +++ b/ports-mgmt/fbsdmon/files/patch-src__io.c @@ -0,0 +1,11 @@ +--- ./src/io.c.orig 2012-01-30 12:34:26.000000000 -0800 ++++ ./src/io.c 2012-01-30 12:34:36.000000000 -0800 +@@ -47,7 +47,7 @@ + extern char* gz_data(char *data) + { + char *fn = strdup("/tmp/fbsdmon.XXXXXX"); +- mktemp(fn); ++ mkstemp(fn); + + gzFile *gz = gzopen(fn, "wb"); + gzputs(gz, data); diff --git a/ports-mgmt/fbsdmon/files/pkg-message.in b/ports-mgmt/fbsdmon/files/pkg-message.in new file mode 100644 index 000000000000..a6ec40605528 --- /dev/null +++ b/ports-mgmt/fbsdmon/files/pkg-message.in @@ -0,0 +1,10 @@ + + To enable weekly reporting, add this line to /etc/periodic.conf: + weekly_fbsdmon_enable="YES" + + To enable boottime reporting, add this line to /etc/rc.conf: + fbsdmon_enable="YES" + + To run it manually, run command: + %%PREFIX%%/sbin/fbsdmon + diff --git a/ports-mgmt/fbsdmon/pkg-descr b/ports-mgmt/fbsdmon/pkg-descr new file mode 100644 index 000000000000..15590c742e20 --- /dev/null +++ b/ports-mgmt/fbsdmon/pkg-descr @@ -0,0 +1,6 @@ +Submit system and ports statistics to fbsdmon.org. + +Statistics can be sent from command line, from rc script +or from periodic script. + +WWW: http://fbsdmon.org/ diff --git a/ports-mgmt/fbsdmon/pkg-plist b/ports-mgmt/fbsdmon/pkg-plist new file mode 100644 index 000000000000..f2ed4abd289a --- /dev/null +++ b/ports-mgmt/fbsdmon/pkg-plist @@ -0,0 +1,6 @@ +sbin/fbsdmon +etc/periodic/weekly/600.fbsdmon +@exec mkdir -p /var/db/fbsdmon || true +@unexec rmdir /var/db/fbsdmon 2>/dev/null || true +@dirrmtry etc/periodic/weekly +@dirrmtry etc/periodic