aboutsummaryrefslogtreecommitdiffstats
path: root/sysutils/munin-node
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2010-02-25 04:18:51 +0800
committerdes <des@FreeBSD.org>2010-02-25 04:18:51 +0800
commit9d4e47279bf5dea8e9cc77d57996862cad7495be (patch)
treedd22be6d3682cffb775fde5f26bd2032d451d287 /sysutils/munin-node
parenta280dc00f6aa7f774e3606c619bf2e6701eee66f (diff)
downloadfreebsd-ports-gnome-9d4e47279bf5dea8e9cc77d57996862cad7495be.tar.gz
freebsd-ports-gnome-9d4e47279bf5dea8e9cc77d57996862cad7495be.tar.zst
freebsd-ports-gnome-9d4e47279bf5dea8e9cc77d57996862cad7495be.zip
Massive cleanup of the Munin ports:
- Use a fixed UID / GID - Fix handling of sample configs in plists - Add missing plist entries (mostly directories) - Use /var/munin instead of %D/var/munin - Consistently use %%FOODIR%% instead of ${PREFIX}/foo etc. - Honor BATCH / PACKAGE_BUILDING - Fix network throughput probes (if_ and if_errcoll_) PR: 120755, 120756, 124528, 129576, 129577, 143804 Submitted by: see PRs Feature safe: yes
Diffstat (limited to 'sysutils/munin-node')
-rw-r--r--sysutils/munin-node/Makefile28
-rw-r--r--sysutils/munin-node/files/patch-node-node.d.freebsd-if_.in.diff16
-rw-r--r--sysutils/munin-node/files/patch-node-node.d.freebsd-if_errcoll_.in.diff17
-rw-r--r--sysutils/munin-node/files/pkg-message.in4
-rw-r--r--sysutils/munin-node/pkg-deinstall11
-rw-r--r--sysutils/munin-node/pkg-install24
-rw-r--r--sysutils/munin-node/pkg-plist23
7 files changed, 70 insertions, 53 deletions
diff --git a/sysutils/munin-node/Makefile b/sysutils/munin-node/Makefile
index 9a8a9e2ae31b..8edd1a020a5d 100644
--- a/sysutils/munin-node/Makefile
+++ b/sysutils/munin-node/Makefile
@@ -7,6 +7,7 @@
PORTNAME= munin
PORTVERSION= 1.4.3
+PORTREVISION= 1
CATEGORIES= sysutils perl5
MASTER_SITES= SF/${PORTNAME}/${PORTNAME}%20stable/${PORTVERSION}
PKGNAMESUFFIX= -node
@@ -32,7 +33,11 @@ PATCH_STRIP= -p0
WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION:S/.r/rc/}
PKGMESSAGE= ${WRKDIR}/pkg-message
-MAKE_ARGS= LIBDIR=${DATADIR} CONFDIR=${ETCDIR} \
+USERS= munin
+GROUPS= munin
+
+DBDIR= /var/${PORTNAME}
+MAKE_ARGS= LIBDIR=${DATADIR} CONFDIR=${ETCDIR} DBDIR=${DBDIR} \
PERL=${PERL} SITE_PERL_REL=${SITE_PERL_REL}
ALL_TARGET= build-node build-plugins
INSTALL_TARGET= install-node-prime install-plugins-prime
@@ -61,23 +66,29 @@ MAN3= ${MAN3_NODE} ${MAN3_PLUGIN}
MAN5= munin-node.conf.5
MAN8= munin.8
+PLIST_SUB= DBDIR=${DBDIR}
SUB_FILES= pkg-message munin-node-revive.sh
USE_RC_SUBR= munin-node.sh
RC_SUBR_SUFFIX= .sh
pre-su-install:
- @PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
+ @${SETENV} ${SCRIPTS_ENV} PKG_PREFIX=${PREFIX} \
+ ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
post-install:
${INSTALL_SCRIPT} ${WRKDIR}/munin-node.sh \
${PREFIX}/etc/rc.d/munin-node.sh
${INSTALL_DATA} ${WRKSRC}/build/node/munin-node.conf \
- ${PREFIX}/etc/munin/munin-node.conf.sample
+ ${ETCDIR}/munin-node.conf.sample
+ @if [ ! -f ${ETCDIR}/munin-node.conf ]; then \
+ ${INSTALL_DATA} ${ETCDIR}/munin-node.conf.sample \
+ ${ETCDIR}/munin-node.conf; \
+ fi
${INSTALL_DATA} ${FILESDIR}/plugins.conf \
- ${PREFIX}/etc/munin/plugin-conf.d/plugins.conf.sample
- @if [ ! -f ${PREFIX}/etc/munin/plugin-conf.d/plugins.conf ]; then \
- ${INSTALL_DATA} ${PREFIX}/etc/munin/plugin-conf.d/plugins.conf.sample \
- ${PREFIX}/etc/munin/plugin-conf.d/plugins.conf; \
+ ${ETCDIR}/plugin-conf.d/plugins.conf.sample
+ @if [ ! -f ${ETCDIR}/plugin-conf.d/plugins.conf ]; then \
+ ${INSTALL_DATA} ${ETCDIR}/plugin-conf.d/plugins.conf.sample \
+ ${ETCDIR}/plugin-conf.d/plugins.conf; \
fi
@(cd ${WRKSRC}/node/blib/bindoc && for man in ${MAN1}; do \
${INSTALL_MAN} -C $$man ${PREFIX}/man/man1; \
@@ -95,7 +106,8 @@ post-install:
${INSTALL_MAN} -C $$man ${PREFIX}/man/man8; \
done)
@${ECHO} ${PORTVERSION} > ${PREFIX}/etc/munin/VERSION.node
- PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
+ @${SETENV} ${SCRIPTS_ENV} PKG_PREFIX=${PREFIX} \
+ ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
@${CAT} ${PKGMESSAGE}
.include <bsd.port.mk>
diff --git a/sysutils/munin-node/files/patch-node-node.d.freebsd-if_.in.diff b/sysutils/munin-node/files/patch-node-node.d.freebsd-if_.in.diff
new file mode 100644
index 000000000000..ff4aa9183927
--- /dev/null
+++ b/sysutils/munin-node/files/patch-node-node.d.freebsd-if_.in.diff
@@ -0,0 +1,16 @@
+--- plugins/node.d.freebsd/if_.in.orig 2009-12-30 13:55:55.000000000 +0100
++++ plugins/node.d.freebsd/if_.in 2010-02-24 18:59:15.670282185 +0100
+@@ -81,9 +81,12 @@
+ if (NF == 10) {
+ print "rbytes.value", $6;
+ print "obytes.value", $9;
+- } else {
++ } else if (NF == 11) {
+ print "rbytes.value", $7;
+ print "obytes.value", $10;
++ } else {
++ print "rbytes.value", $8;
++ print "obytes.value", $11;
+ }
+ }'
+ fi
diff --git a/sysutils/munin-node/files/patch-node-node.d.freebsd-if_errcoll_.in.diff b/sysutils/munin-node/files/patch-node-node.d.freebsd-if_errcoll_.in.diff
new file mode 100644
index 000000000000..83b671655aaf
--- /dev/null
+++ b/sysutils/munin-node/files/patch-node-node.d.freebsd-if_errcoll_.in.diff
@@ -0,0 +1,17 @@
+--- plugins/node.d.freebsd/if_errcoll_.in.orig 2009-12-30 13:55:55.000000000 +0100
++++ plugins/node.d.freebsd/if_errcoll_.in 2010-02-24 19:00:26.026407278 +0100
+@@ -59,9 +59,13 @@
+ print "ierrors.value", $5;
+ print "oerrors.value", $8;
+ print "collisions.value", $10;
+- } else {
++ } else if (NF == 11) {
+ print "ierrors.value", $6;
+ print "oerrors.value", $9;
+ print "collisions.value", $11;
++ } else {
++ print "ierrors.value", $6;
++ print "oerrors.value", $10;
++ print "collisions.value", $12;
+ }
+ }'
diff --git a/sysutils/munin-node/files/pkg-message.in b/sysutils/munin-node/files/pkg-message.in
index 2bb30e8e5e4c..d28dc2b0ef02 100644
--- a/sysutils/munin-node/files/pkg-message.in
+++ b/sysutils/munin-node/files/pkg-message.in
@@ -1,6 +1,6 @@
********************************************************************
Unless this file already existed, a sample configuration file
-has been placed in %%ETCDIR%%/munin/munin-node.conf.
+has been placed in %%ETCDIR%%/munin-node.conf.
Please edit it according to your needs.
@@ -15,5 +15,5 @@ Then, it will be started on the next boot. If this line is already
present, the client will be started now. Otherwise, edit
/etc/rc.conf and execute this command:
- %%ETCDIR%%/rc.d/munin-node.sh start
+ %%PREFIX%%/etc/rc.d/munin-node.sh start
********************************************************************
diff --git a/sysutils/munin-node/pkg-deinstall b/sysutils/munin-node/pkg-deinstall
index 4a3410cd306f..37776c3061b8 100644
--- a/sysutils/munin-node/pkg-deinstall
+++ b/sysutils/munin-node/pkg-deinstall
@@ -37,16 +37,6 @@ stop_process() {
fi
}
-delete_group() {
- local g
-
- g=$1
- if yesno "Do you want me to remove group \"${g}\"" y; then
- pw groupdel -n ${g}
- echo "Done."
- fi
-}
-
delete_crontab_entries() {
local prog
prog=$1
@@ -90,6 +80,5 @@ case $2 in
fi
;;
POST-DEINSTALL)
- delete_group munin
;;
esac
diff --git a/sysutils/munin-node/pkg-install b/sysutils/munin-node/pkg-install
index 06c2187aa44e..5b5e5b5fec5f 100644
--- a/sysutils/munin-node/pkg-install
+++ b/sysutils/munin-node/pkg-install
@@ -29,29 +29,6 @@ yesno() {
done
}
-make_group() {
- local g
-
- g=$1
-
- if pw group show "${g}" >/dev/null 2>&1; then
- echo "You already have a group \"${g}\", so I will use it."
- else
- echo "You need a group \"${g}\"."
- if which -s pw && yesno "Would you like me to create it" y; then
- pw groupadd ${g} || exit
- echo "Done."
- else
- echo "Please create it, and try again."
- if ! /usr/sbin/pw user show ${u} >/dev/null 2>/dev/null; then
- echo "While you're at it, please create a user \"${u}\" too,"
- echo "with a default group of \"${g}\"."
- fi
- exit 1
- fi
- fi
-}
-
init_plugins() {
if [ -f ${PKG_PREFIX}/etc/munin/VERSION.node ]; then
prevver=$(cat ${PKG_PREFIX}/etc/munin/VERSION.node)
@@ -109,7 +86,6 @@ EOT
case $2 in
PRE-INSTALL)
- make_group munin
;;
POST-INSTALL)
if [ -z "${PACKAGE_BUILDING}" ]; then
diff --git a/sysutils/munin-node/pkg-plist b/sysutils/munin-node/pkg-plist
index 5042f619b5b9..55d8ddea54b6 100644
--- a/sysutils/munin-node/pkg-plist
+++ b/sysutils/munin-node/pkg-plist
@@ -1,7 +1,12 @@
+@stopdaemon munin-node
bin/munindoc
-etc/munin/VERSION.node
-etc/munin/munin-node.conf.sample
-etc/munin/plugin-conf.d/plugins.conf.sample
+%%ETCDIR%%/VERSION.node
+@unexec if cmp -s %D/%%ETCDIR%%/munin-node.conf.sample %D/%%ETCDIR%%/munin-node.conf ; then rm -f %D/%%ETCDIR%%/munin-node.conf ; fi
+%%ETCDIR%%/munin-node.conf.sample
+@exec if [ ! -f %D/%%ETCDIR%%/munin-node.conf ] ; then cp -p %D/%%ETCDIR%%/munin-node.conf.sample %D/%%ETCDIR%%/munin-node.conf ; fi
+@unexec if cmp -s %D/%%ETCDIR%%/plugin-conf.d/plugins.conf.sample %D/%%ETCDIR%%/plugin-conf.d/plugins.conf ; then rm -f %D/%%ETCDIR%%/plugin-conf.d/plugins.conf ; fi
+%%ETCDIR%%/plugin-conf.d/plugins.conf.sample
+@exec if [ ! -f %D/%%ETCDIR%%/plugin-conf.d/plugins.conf ] ; then cp -p %D/%%ETCDIR%%/plugin-conf.d/plugins.conf.sample %D/%%ETCDIR%%/plugin-conf.d/plugins.conf ; fi
%%SITE_PERL%%/Munin/Node/Config.pm
%%SITE_PERL%%/Munin/Node/Configure/Debug.pm
%%SITE_PERL%%/Munin/Node/Configure/History.pm
@@ -212,14 +217,16 @@ sbin/munin-run
%%DATADIR%%/plugins/vmstat
%%DATADIR%%/plugins/warning_tester
%%DATADIR%%/plugins/zimbra_
-@dirrmtry var/munin/plugin-state
-@dirrmtry var/munin
+@dirrmtry %%DBDIR%%/plugin-state
+@dirrmtry %%DBDIR%%
@dirrm %%DATADIR%%/plugins
@dirrmtry %%DATADIR%%
@dirrm %%SITE_PERL%%/Munin/Plugin
@dirrm %%SITE_PERL%%/Munin/Node/Configure
@dirrm %%SITE_PERL%%/Munin/Node
@dirrmtry %%SITE_PERL%%/Munin
-@dirrmtry etc/munin/plugins
-@dirrmtry etc/munin/plugin-conf.d
-@dirrmtry etc/munin
+@exec mkdir -p %D/%%ETCDIR%%/plugins
+@dirrmtry %%ETCDIR%%/plugins
+@exec mkdir -p %D/%%ETCDIR%%/plugin-conf.d
+@dirrmtry %%ETCDIR%%/plugin-conf.d
+@dirrmtry %%ETCDIR%%