1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-19 00:13:33 +00:00

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
This commit is contained in:
Dag-Erling Smørgrav 2010-02-24 20:18:51 +00:00
parent 624ba99d6b
commit 9203aa68d3
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=250270
16 changed files with 94 additions and 146 deletions

1
GIDs
View File

@ -139,6 +139,7 @@ puppet:*:814:
openacs:*:820:
dotlrn:*:821:
netdisco:*:840:
munin:*:842:
fossy:*:901:www
bacula:*:910:
iserv:*:911:

1
UIDs
View File

@ -149,6 +149,7 @@ puppet:*:814:814::0:0:Puppet Daemon:/nonexistent:/usr/sbin/nologin
openacs:*:820:820::0:0:OpenACS Daemon User:/nonexistent:/usr/sbin/nologin
dotlrn:*:821:821::0:0:.LRN Daemon User:/nonexistent:/usr/sbin/nologin
netdisco:*:840:840::0:0:netdisco daemon:/nonexistent:/usr/sbin/nologin
munin:*:842:842::0:0:Munin:/var/munin:/usr/sbin/nologin
fossy:*:901:901::0:0:FOSSology user:/usr/local/share/fossology:/usr/local/bin/bash
bacula:*:910:910::0:0:Bacula Daemon:/var/db/bacula:/usr/sbin/nologin
iserv:*:911:911::0:0:Iserv Daemon:/nonexistent:/usr/sbin/nologin

View File

@ -7,6 +7,7 @@
PORTNAME= munin
PORTVERSION= 1.4.3
PORTREVISION= 1
CATEGORIES= sysutils perl5
MASTER_SITES= SF/${PORTNAME}/${PORTNAME}%20stable/${PORTVERSION}
PKGNAMESUFFIX= -common
@ -22,9 +23,9 @@ USE_PERL5= yes
USE_GMAKE= yes
PATCH_STRIP= -p1
WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION:S/.r/rc/}
PKGMESSAGE= ${WRKDIR}/pkg-message
MAKE_ARGS= LIBDIR=${DATADIR} CONFDIR=${ETCDIR} \
DBDIR= /var/${PORTNAME}
MAKE_ARGS= LIBDIR=${DATADIR} CONFDIR=${ETCDIR} DBDIR=${DBDIR} \
PERL=${PERL} SITE_PERL_REL=${SITE_PERL_REL}
ALL_TARGET= build-common-prime
INSTALL_TARGET= install-common
@ -36,8 +37,6 @@ MAN3= Munin::Common::Config.3 \
Munin::Common::TLSServer.3 \
Munin::Common::Timeout.3
SUB_FILES= pkg-message
post-install:
@(cd ${WRKSRC}/common/blib/libdoc && for man in ${MAN3} ; do \
${INSTALL_MAN} -C $$man ${PREFIX}/man/man3; \

View File

@ -1,8 +0,0 @@
********************************************************************
Unless this file already existed, a sample configuration file
has been placed in %%PREFIX%%/etc/munin/munin.conf.
Please edit it according to your needs.
The Munin server will be run from cron under the user 'munin'.
********************************************************************

View File

@ -7,6 +7,7 @@
PORTNAME= munin
PORTVERSION= 1.4.3
PORTREVISION= 1
CATEGORIES= sysutils perl5
MASTER_SITES= SF/${PORTNAME}/${PORTNAME}%20stable/${PORTVERSION}
PKGNAMESUFFIX= -master
@ -42,7 +43,11 @@ PATCH_STRIP= -p1
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} \
WWWDIR=${WWWDIR} CGIDIR=${WWWDIR}/cgi-bin \
PERL=${PERL} SITE_PERL_REL=${SITE_PERL_REL}
ALL_TARGET= build-master build-man
@ -67,10 +72,12 @@ MAN8= munin-cron.8 \
munin-limits.8 \
munin-update.8
PLIST_SUB= DBDIR=${DBDIR}
SUB_FILES= pkg-message
pre-install:
@PKG_PREFIX=${PREFIX} ${SH} ${PKGDIR}/pkg-install ${PKGNAME} PRE-INSTALL
@${SETENV} ${SCRIPTS_ENV} PKG_PREFIX=${PREFIX} \
${SH} ${PKGDIR}/pkg-install ${PKGNAME} PRE-INSTALL
post-install:
@${INSTALL_DATA} ${WRKSRC}/build/master/munin.conf ${PREFIX}/etc/munin/munin.conf.sample
@ -83,9 +90,10 @@ post-install:
@(cd ${WRKSRC}/build/doc && for man in ${MAN8}; do \
${INSTALL_MAN} -C $$man ${PREFIX}/man/man8; \
done)
@DATADIR=${DATADIR} PKG_PREFIX=${PREFIX} ${SH} ${PKGDIR}/pkg-install ${PKGNAME} POST-INSTALL
@${SETENV} ${SCRIPTS_ENV} PKG_PREFIX=${PREFIX} \
${SH} ${PKGDIR}/pkg-install ${PKGNAME} POST-INSTALL
@${CHOWN} munin /var/log/munin-master
@${CHGRP} munin /var/run/munin /var/log/munin-master ${WWWDIR} ${PREFIX}/var/munin
@${CHGRP} munin /var/run/munin /var/log/munin-master ${WWWDIR} ${DBDIR}
@${CAT} ${PKGMESSAGE}
.include <bsd.port.mk>

View File

@ -1,6 +1,6 @@
********************************************************************
Unless this file already existed, a sample configuration file
has been placed in %%ETCDIR%%/munin/munin.conf.
has been placed in %%ETCDIR%%/munin.conf.
Please edit it according to your needs.

View File

@ -29,40 +29,6 @@ yesno() {
done
}
delete_account() {
local u g home
u=$1
g=$2
if pw group show ${g} > /dev/null 2>&1; then
if yesno "Do you want me to remove group \"${g}\"" y; then
pw group del -n ${g}
echo "Done."
else
GID=`pw group show ${g} | awk -F: '{ print $3 }'`
fi
fi
if pw user show ${u} > /dev/null 2>&1; then
if yesno "Do you want me to remove user \"${u}\"" y; then
eval home=~${u}
pw user del -n ${u} -r
echo "Done."
if [ -d "${home}" ]; then
echo "Please remember to remove the home directory \"${home}\""
fi
# pw user del may have removed the group, too.
# Put it back if the admin asked us to retain it.
if [ -n "$GID" ]; then
pw group show ${g} > /dev/null 2>&1
if [ $? -ne 0 ]; then
pw group add ${g}
fi
fi
fi
fi
}
delete_crontab_entries() {
local b e
b=$1
@ -113,6 +79,5 @@ case $2 in
fi
;;
POST-DEINSTALL)
delete_account munin munin
;;
esac

View File

@ -29,45 +29,6 @@ yesno() {
done
}
make_account() {
local u g gcos
u=$1
g=$2
gcos=$3
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
if pw user show "${u}" >/dev/null 2>&1; then
echo "You already have a user \"${u}\", so I will use it."
else
echo "You need a user \"${u}\"."
if which -s pw && yesno "Would you like me to create it" y; then
pw useradd ${u} -g ${g} -h - \
-s /bin/sh -c "${gcos}" || exit
echo "Done."
else
echo "Please create it, and try again."
exit 1
fi
fi
}
create_crontab_entries() {
local b e
b=$1
@ -109,7 +70,6 @@ move_www_dir() {
case $2 in
PRE-INSTALL)
make_account munin munin "Munin owner"
move_www_dir # at some point in the installation, the www dir is created
;;
POST-INSTALL)

View File

@ -1,6 +1,8 @@
bin/munin-check
bin/munin-cron
@unexec if cmp -s %D/%%ETCDIR%%/munin.conf.sample %D/%%ETCDIR%%/munin.conf ; then rm -f %D/%%ETCDIR%%/munin.conf ; fi
%%ETCDIR%%/munin.conf.sample
@exec if [ ! -f %D/%%ETCDIR%%/munin.conf ] ; then cp -p %D/%%ETCDIR%%/munin.conf.sample %D/%%ETCDIR%%/munin.conf ; fi
%%ETCDIR%%/templates/definitions.html
%%ETCDIR%%/templates/favicon.ico
%%ETCDIR%%/templates/logo-h.png
@ -48,8 +50,11 @@ bin/munin-cron
@dirrmtry %%WWWDIR%%/cgi-bin
@dirrmtry %%WWWDIR%%
@dirrmtry %%DATADIR%%
@dirrmtry var/munin
@dirrmtry %%DBDIR%%
@dirrm %%SITE_PERL%%/Munin/Master
@dirrmtry %%SITE_PERL%%/Munin
@dirrmtry %%ETCDIR%%/templates/partial
@dirrmtry %%ETCDIR%%/templates
@exec mkdir -p %D/%%ETCDIR%%/munin-conf.d
@dirrmtry %%ETCDIR%%/munin-conf.d
@dirrmtry %%ETCDIR%%

View File

@ -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>

View File

@ -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

View File

@ -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;
}
}'

View File

@ -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
********************************************************************

View File

@ -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

View File

@ -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

View File

@ -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%%