Bug 74166 - Update port: sysutils/munin-node 1.0.3 -> 1.0.4
Summary: Update port: sysutils/munin-node 1.0.3 -> 1.0.4
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-20 16:20 UTC by Lupe Christoph
Modified: 2004-12-14 01:46 UTC (History)
0 users

See Also:


Attachments
munin-node-1.0.4.patch (9.81 KB, patch)
2004-11-20 16:20 UTC, Lupe Christoph
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Lupe Christoph 2004-11-20 16:20:31 UTC
	Update to support Munin 1.0.4.
	Prevent breakage my FreeBSD 5.3 ports make system (NOPRECIOUSMAKEVARS=yes).
	Support FreeBSD 5 rc system in addition to old system.
	Remove unchanged config files on deinstall as suggested by Yen-Ming Lee.
	Cosmetic changes to pkg.plist while I'm at it anyway.
	Patch Munin plugins to support FreeBSD > 5.
		(To be removed after integration into Munin.)

	Files changed:
		Makefile
		distinfo
		files/munin-node.sh
		files/pkg-message
		pkg-deinstall
		pkg-plist
	Files added:
		files/munin_node.sh
		files/patch-cpu.in
		files/patch-vmstat.in
		files/pkg-message.4
Comment 1 Sergey Matveychuk freebsd_committer 2004-11-24 20:12:23 UTC
These symlinks polute $PREFIX/etc on 4.10:
etc/munin/plugins/cpu
etc/munin/plugins/df
etc/munin/plugins/df_inode
etc/munin/plugins/if_errcoll_ppp0
etc/munin/plugins/if_errcoll_vr0
etc/munin/plugins/if_ppp0
etc/munin/plugins/if_vr0
etc/munin/plugins/load
etc/munin/plugins/memory
etc/munin/plugins/netstat
etc/munin/plugins/open_files
etc/munin/plugins/processes
etc/munin/plugins/swap
etc/munin/plugins/vmstat

And why do you need to leave etc/munin/VERSION.node?
-- 
Sem.
Comment 2 Lupe Christoph 2004-11-26 07:22:59 UTC
Third version of the update patch. Now it has a deinstall message.
Previously, only munin-node had this, and for both ports. The deinstall
message in munin-node gets corrected by a correspondingly changed update
patch. Both messages refer to the other port for common parts.

Lupe Christoph
--- munin-main-1.0.4.patch begins here ---
diff -ruN /usr/ports/sysutils/munin-main/Makefile munin-main-1.0.4/Makefile
--- /usr/ports/sysutils/munin-main/Makefile	Thu Nov 18 06:56:53 2004
+++ munin-main-1.0.4/Makefile	Wed Nov 24 23:03:19 2004
@@ -6,7 +6,7 @@

 
 PORTNAME=	munin
-PORTVERSION=	1.0.3
+PORTVERSION=	1.0.4
 CATEGORIES=	sysutils perl5
 MASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
 MASTER_SITE_SUBDIR=	munin
@@ -44,6 +44,12 @@
 	@PKG_PREFIX=${PREFIX} ${SH} pkg-install ${PKGNAME} PRE-INSTALL
 
 post-install:
+	@if [ ! -f ${PREFIX}/www/data/munin/style.css ]; then \
+		${INSTALL_DATA} ${PREFIX}/etc/munin/templates/style.css ${PREFIX}/www/data/munin/style.css; \
+	fi
+	@if [ ! -f ${PREFIX}/www/data/munin/logo.png ]; then \
+		${INSTALL_DATA} ${PREFIX}/etc/munin/templates/logo.png ${PREFIX}/www/data/munin/logo.png; \
+	fi
 	@${INSTALL_MAN} -C ${WRKSRC}/build/doc/munin.conf.5 ${PREFIX}/man/man5
 	@${INSTALL_MAN} -C ${WRKSRC}/build/doc/munin-cron.8 ${PREFIX}/man/man8
 	@${INSTALL_MAN} -C ${WRKSRC}/build/doc/munin-graph.8 ${PREFIX}/man/man8
diff -ruN /usr/ports/sysutils/munin-main/distinfo munin-main-1.0.4/distinfo
--- /usr/ports/sysutils/munin-main/distinfo	Thu Nov 18 06:56:53 2004
+++ munin-main-1.0.4/distinfo	Wed Nov 24 22:59:37 2004
@@ -1,2 +1,2 @@
-MD5 (munin_1.0.3.tar.gz) = 8114e4d716e0ec7ac70357a697af28cf
-SIZE (munin_1.0.3.tar.gz) = 214362
+MD5 (munin_1.0.4.tar.gz) = 00721181e1ff81be85ad89307457d998
+SIZE (munin_1.0.4.tar.gz) = 214902
diff -ruN /usr/ports/sysutils/munin-main/pkg-plist munin-main-1.0.4/pkg-plist
--- /usr/ports/sysutils/munin-main/pkg-plist	Sat Jun 12 19:41:59 2004
+++ munin-main-1.0.4/pkg-plist	Fri Nov 26 07:56:37 2004
@@ -1,4 +1,6 @@
 bin/munin-cron
+@unexec if cmp -s %D/etc/munin/templates/style.css %D/www/data-dist/munin/style.css; then rm -f %D/www/data-dist/munin/style.css; fi
+@unexec if cmp -s %D/etc/munin/templates/logo.png %D/www/data-dist/munin/logo.png; then rm -f %D/www/data-dist/munin/logo.png; fi
 etc/munin/munin.conf
 etc/munin/templates/logo.png
 etc/munin/templates/munin-domainview.tmpl
@@ -18,3 +20,22 @@
 @unexec rmdir %D/share/munin 2>/dev/null || true
 @dirrm etc/munin/templates
 @unexec rmdir %D/etc/munin 2>/dev/null || true
+@unexec echo
+@unexec echo '********************************************************************'
+@unexec echo "If you want to *completely* remove munin-main, you have to"
+@unexec echo
+@unexec echo "    rm -rf %D/var/munin/datafile %D/www/data/munin \\"
+@unexec echo "          "`ls -d /usr/local/var/munin/* | grep -v plugin-state`" \\"
+@unexec if [ -f %D/etc/munin/munin.conf ]; then echo "           %D/etc/munin/munin.conf \\"; fi
+@unexec if [ -d %D/etc/munin/templates ]; then echo "           %D/etc/munin/templates \\"; fi
+@unexec echo "           %D/etc/munin/munin-node.conf %D/etc/munin/plugins \\"
+@unexec echo "           /var/log/munin"
+@unexec echo
+@unexec echo "If you have already deinstalled munin-node, you can also"
+@unexec echo
+@unexec echo "    rmdir %D/etc/munin %D/var/munin"
+@unexec echo
+@unexec echo "These files and directories have to be left on the system because"
+@unexec echo "you may be performing an update. This process can't tell."
+@unexec echo '********************************************************************'
+@unexec echo
 -- munin-main-1.0.4.patch ends here ---
-- 
| lupe@lupe-christoph.de       |           http://www.lupe-christoph.de/ |
| "... putting a mail server on the Internet without filtering is like   |
| covering yourself with barbecue sauce and breaking into the Charity    |
| Home for Badgers with Rabies.                            Michael Lucas |
Comment 3 Lupe Christoph 2004-11-26 07:23:01 UTC
Second version of the update patch. The deinstall message is corrected to
omit parts that belong to munin-main. The deinstall message in munin-main
gets corrected by a correspondingly changed update patch. Both messages
refer to the other port for common parts.

Lupe Christoph
--- munin-node-1.0.4.patch begins here ---
diff -ruN /usr/ports/sysutils/munin-node/Makefile munin-node-1.0.4/Makefile
--- /usr/ports/sysutils/munin-node/Makefile	Tue Nov 16 16:16:37 2004
+++ munin-node-1.0.4/Makefile	Sun Nov 21 11:47:09 2004
@@ -6,7 +6,7 @@
 #
 
 PORTNAME=	munin
-PORTVERSION=	1.0.3
+PORTVERSION=	1.0.4
 CATEGORIES=	sysutils perl5
 MASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
 MASTER_SITE_SUBDIR=	munin
@@ -32,17 +32,30 @@
 ALL_TARGET=	DATADIR=${DATADIR} build build-man
 INSTALL_TARGET=	DATADIR=${DATADIR} install-node install-node-plugins
 MAKE_ENV=	LANG=C
+NOPRECIOUSMAKEVARS=yes
 
 MAN5=		munin-node.conf.5
 MAN8=		munin-node-configure.8 munin-node.8 munin-run.8
 
+.if ${OSVERSION} < 500000
+PKGMSG=${FILESDIR}/pkg-message.4
+STARTSTOP_SRC=${FILESDIR}/munin-node.sh
+STARTSTOP_DST=${PREFIX}/etc/rc.d/munin-node.sh
+.else
+PKGMSG=${FILESDIR}/pkg-message
+STARTSTOP_SRC=${FILESDIR}/munin_node.sh
+STARTSTOP_DST=/etc/rc.d/munin_node
+.endif
+
 pre-install:
-	@${SED} 's@%%PREFIX%%@${PREFIX}@g' ${FILESDIR}/pkg-message > ${PKGMESSAGE}
+	@${SED} 's@%%PREFIX%%@${PREFIX}@g' ${PKGMSG} > ${PKGMESSAGE}
 	@PKG_PREFIX=${PREFIX} ${SH} pkg-install ${PKGNAME} PRE-INSTALL
 
 post-install:
-	@${SED} 's@%PREFIX%@${LOCALBASE}@g' ${FILESDIR}/munin-node.sh > ${PREFIX}/etc/rc.d/munin-node.sh
-	@${CHMOD} +x ${PREFIX}/etc/rc.d/munin-node.sh
+	@${SED} 's@%PREFIX%@${LOCALBASE}@g' ${STARTSTOP_SRC} > ${STARTSTOP_DST}
+	@${CHMOD} +x ${STARTSTOP_DST}
+	${INSTALL_DATA} ${WRKSRC}/build/node/munin-node.conf ${PREFIX}/etc/munin/munin-node.conf.sample
+	${INSTALL_DATA} ${WRKSRC}/plugins.conf ${PREFIX}/etc/munin/plugin-conf.d/plugins.conf.sample
 	@if [ ! -f ${PREFIX}/etc/munin/plugin-conf.d/plugins.conf ]; then \
 		${INSTALL_DATA} ${WRKSRC}/plugins.conf ${PREFIX}/etc/munin/plugin-conf.d/plugins.conf; \
 	fi
diff -ruN /usr/ports/sysutils/munin-node/distinfo munin-node-1.0.4/distinfo
--- /usr/ports/sysutils/munin-node/distinfo	Tue Nov 16 16:16:37 2004
+++ munin-node-1.0.4/distinfo	Sun Nov 21 11:42:35 2004
@@ -1,2 +1,2 @@
-MD5 (munin_1.0.3.tar.gz) = 8114e4d716e0ec7ac70357a697af28cf
-SIZE (munin_1.0.3.tar.gz) = 214362
+MD5 (munin_1.0.4.tar.gz) = 00721181e1ff81be85ad89307457d998
+SIZE (munin_1.0.4.tar.gz) = 214902
diff -ruN /usr/ports/sysutils/munin-node/files/munin-node.sh munin-node-1.0.4/files/munin-node.sh
--- /usr/ports/sysutils/munin-node/files/munin-node.sh	Tue Mar  2 16:54:05 2004
+++ munin-node-1.0.4/files/munin-node.sh	Sun Nov 21 11:44:10 2004
@@ -14,7 +14,13 @@
 		if [ -f $CONFIG ]; then
 			PIDFILE=`awk '$1 == "pid_file" { print $2 }' $CONFIG`
 			if [ -f $PIDFILE ]; then
-				/bin/kill `cat $PIDFILE` && echo -n ' munin-node'
+				PID=`cat $PIDFILE`
+				CMD=`ps -xa -o command -p $PID | sed 1d`
+				case "$CMD" in
+				*munin-node*)
+					/bin/kill $PID && echo -n ' munin-node'
+					;;
+				esac
 			fi
 		fi
 	;;
diff -ruN /usr/ports/sysutils/munin-node/files/munin_node.sh munin-node-1.0.4/files/munin_node.sh
--- /usr/ports/sysutils/munin-node/files/munin_node.sh	Thu Jan  1 01:00:00 1970
+++ munin-node-1.0.4/files/munin_node.sh	Sun Nov 21 11:55:43 2004
@@ -0,0 +1,28 @@
+#!/bin/sh
+#
+
+# PROVIDE: munin-node
+# REQUIRE: DAEMON
+# BEFORE:  cron
+# KEYWORD: FreeBSD
+
+#
+# Add the following lines to /etc/rc.conf to enable munin-node:
+# munin_node_enable (bool):      Set to "NO" by default.
+#                                Set it to "YES" to enable munin-node
+# munin_node_config (path):      Set to "%PREFIX%/etc/munin/munin-node.conf" by default.
+#
+
+. /etc/rc.subr
+
+name="munin_node"
+rcvar=`set_rcvar`
+
+[ -z "$munin_node_enable" ] && munin_node_enable="NO"
+[ -z "$munin_node_config" ] && munin_node_config="/usr/local/etc/munin/munin-node.conf"
+
+command="/usr/local/sbin/munin-node"
+pidfile=`awk '$1 == "pid_file" { print $2 }' $munin_node_config`
+
+load_rc_config $name
+run_rc_command "$1"
diff -ruN /usr/ports/sysutils/munin-node/files/patch-cpu.in munin-node-1.0.4/files/patch-cpu.in
--- /usr/ports/sysutils/munin-node/files/patch-cpu.in	Thu Jan  1 01:00:00 1970
+++ munin-node-1.0.4/files/patch-cpu.in	Sun Nov 21 11:55:43 2004
@@ -0,0 +1,15 @@
+--- munin-1.0.4.orig/node/node.d.freebsd/cpu.in	Sun May  9 21:18:35 2004
++++ munin-1.0.4/node/node.d.freebsd/cpu.in	Sat Nov 20 15:32:50 2004
+@@ -59,10 +59,10 @@
+ 	OSV=`/sbin/sysctl -n kern.osrelease | cut -f1 -d.`
+ 	if [ "$OSV" = "4" ]; then
+ 		STATUNITS=`/sbin/sysctl -n kern.clockrate | cut -f16 -d' '`
+-	elif [ "$OSV" = "5" ]; then
++	elif [ "$OSV" -ge "5" ]; then
+ 		STATUNITS=`/sbin/sysctl -n kern.clockrate | cut -f13 -d' '`
+ 	fi
+-#	PERCENT=`/sbin/sysctl -n hw.ncpu | awk '{print ($1)*100}'`
++	PERCENT=`/sbin/sysctl -n hw.ncpu | awk '{print ($1)*100}'`
+ 	SCALE=`echo 'scale=5;' $PERCENT/$STATUNITS | bc -q `
+ 	NCPU=`/sbin/sysctl -n hw.ncpu`
+ 	if [ "$scaleto100" = yes ]; then
diff -ruN /usr/ports/sysutils/munin-node/files/patch-vmstat.in munin-node-1.0.4/files/patch-vmstat.in
--- /usr/ports/sysutils/munin-node/files/patch-vmstat.in	Thu Jan  1 01:00:00 1970
+++ munin-node-1.0.4/files/patch-vmstat.in	Sun Nov 21 11:55:43 2004
@@ -0,0 +1,29 @@
+--- munin-1.0.4.orig/node/node.d.freebsd/vmstat.in	Sun Feb  1 19:59:54 2004
++++ munin-1.0.4/node/node.d.freebsd/vmstat.in	Sat Nov 20 14:14:54 2004
+@@ -32,7 +32,7 @@
+ OSV=`/sbin/sysctl -n kern.osrelease | cut -f1 -d.`
+ 
+ if [ "$1" = "autoconf" ]; then
+-	if [ "$OSV" = "5" ]; then
++	if [ "$OSV" -ge "5" ]; then
+ 		/sbin/sysctl -n vm.vmtotal 2>/dev/null >/dev/null
+ 		RESULT=$?
+ 		NAME=/sbin/sysctl
+@@ -59,7 +59,7 @@
+ 	echo 'graph_title VMstat'
+ 	echo 'graph_args --base 1000 -l 0'
+ 	echo 'graph_vlabel process states'
+-	if [ "$OSV" = "5" ]; then
++	if [ "$OSV" -ge "5" ]; then
+ 		echo 'running.label running'
+ 		echo 'running.type GAUGE'
+ 		echo 'diskwait.label diskwait'
+@@ -77,7 +77,7 @@
+ 	exit 0
+ fi
+ 
+-if [ "$OSV" = "5" ]; then
++if [ "$OSV" -ge "5" ]; then
+ 	sysctl -n vm.vmtotal | awk '
+ /^Processes:/ {
+ 	print "running.value", $3;
diff -ruN /usr/ports/sysutils/munin-node/files/pkg-message munin-node-1.0.4/files/pkg-message
--- /usr/ports/sysutils/munin-node/files/pkg-message	Tue Mar  2 16:54:05 2004
+++ munin-node-1.0.4/files/pkg-message	Sun Nov 21 11:45:15 2004
@@ -5,8 +5,16 @@
 
 Please edit it according to your needs.
 
-The Munin client will be started at system boot automatically.
-You can start it manually with:
-    %%PREFIX%%/etc/rc.d/munin-node.sh start
+********************************************************************
+
+The Munin client will *not* be started automatically. To allow it
+to start, put this line in /etc/rc.conf:
+
+munin_node_enable="YES"
+
+Then, it will be started on the next boot. To start it now, use
+this command:
+
+    /etc/rc.d/munin_node start
 ********************************************************************
 
diff -ruN /usr/ports/sysutils/munin-node/files/pkg-message.4 munin-node-1.0.4/files/pkg-message.4
--- /usr/ports/sysutils/munin-node/files/pkg-message.4	Thu Jan  1 01:00:00 1970
+++ munin-node-1.0.4/files/pkg-message.4	Sun Nov 21 11:55:43 2004
@@ -0,0 +1,12 @@
+
+********************************************************************
+Unless this file already existed, a sample configuration file
+has been placed in %%PREFIX%%/etc/munin/munin-node.conf.
+
+Please edit it according to your needs.
+
+The Munin client will be started at system boot automatically.
+You can start it manually with:
+    %%PREFIX%%/etc/rc.d/munin-node.sh start
+********************************************************************
+
diff -ruN /usr/ports/sysutils/munin-node/pkg-deinstall munin-node-1.0.4/pkg-deinstall
--- /usr/ports/sysutils/munin-node/pkg-deinstall	Tue Mar  2 16:54:05 2004
+++ munin-node-1.0.4/pkg-deinstall	Sun Nov 21 11:52:27 2004
@@ -1,6 +1,9 @@
 #! /bin/sh
 #
 # $Log: pkg-deinstall,v $
+# Revision 1.2.2.1  2004/11/21 10:52:27  lupe
+# make stop_process use old or new start-stop script.
+#
 # Revision 1.2  2004/02/06 18:49:58  lupe
 # Fixes for pkg_add compatibility.
 #
@@ -36,8 +39,8 @@
 }
 
 stop_process() {
-    if [ -x ${PKG_PREFIX}/etc/rc.d/munin-node.sh ]; then
-	${PKG_PREFIX}/etc/rc.d/munin-node.sh stop
+    if [ -x $STARTSTOP ]; then
+	$STARTSTOP stop
     fi
 }
 
@@ -51,9 +54,17 @@
     fi
 }
 
+OSVERSION=`/sbin/sysctl -n kern.osreldate`
+if [ $OSVERSION -lt 500000 ]; then
+    STARTSTOP=${PKG_PREFIX}/etc/rc.d/munin-node.sh
+else
+    STARTSTOP=/etc/rc.d/munin_node
+fi
+
 case $2 in
     DEINSTALL)
 	stop_process
+	exit 0 # ignore error
 	;;
     POST-DEINSTALL)
 	delete_group munin
diff -ruN /usr/ports/sysutils/munin-node/pkg-plist munin-node-1.0.4/pkg-plist
--- /usr/ports/sysutils/munin-node/pkg-plist	Tue Nov 16 16:16:37 2004
+++ munin-node-1.0.4/pkg-plist	Fri Nov 26 07:57:23 2004
@@ -1,7 +1,10 @@
 @comment etc/munin/VERSION.node must remain for upgrade version check
-etc/munin/munin-node.conf
-etc/munin/plugin-conf.d/plugins.conf
-etc/rc.d/munin-node.sh
+@unexec if cmp -s %D/etc/munin/munin-node.conf %D/etc/munin/munin-node.conf.sample; then rm -f %D/etc/munin/munin-node.conf; fi
+etc/munin/munin-node.conf.sample
+@unexec if cmp -s %D/etc/munin/plugin-conf.d/plugins.conf %D/etc/munin/plugin-conf.d/plugins.conf.sample; then rm -f %D/etc/munin/plugin-conf.d/plugins.conf; fi
+etc/munin/plugin-conf.d/plugins.conf.sample
+@unexec rm %D/etc/rc.d/munin-node.sh 2>/dev/null || true
+@unexec rm /etc/rc.d/munin_node 2>/dev/null || true
 sbin/munin-node
 sbin/munin-node-configure
 sbin/munin-run
@@ -73,7 +76,19 @@
 @unexec rmdir %D/%%DATADIR%% 2>/dev/null || true
 @unexec rmdir %D/etc/munin/plugin-conf.d 2>/dev/null || true
 @unexec rmdir %D/etc/munin 2>/dev/null || true
+@unexec echo
+@unexec echo '********************************************************************'
 @unexec echo "If you want to *completely* remove munin-node, you have to"
-@unexec echo "    rm -rf %D/var/munin and %D/etc/munin %D/www/data/munin"
-@unexec echo "They have to be left on the system because you may be performing"
-@unexec echo "an update. This process can't tell."
+@unexec echo
+@unexec echo "    rm -rf %D/var/munin/plugin-state %D/etc/munin/VERSION.node \\"
+@unexec echo "           %D/etc/munin/munin-node.conf %D/etc/munin/plugins \\"
+@unexec echo "           /var/log/munin-node.log*"
+@unexec echo
+@unexec echo "If you have already deinstalled munin-main, you can also"
+@unexec echo
+@unexec echo "    rmdir %D/etc/munin %D/var/munin"
+@unexec echo
+@unexec echo "These files and directories have to be left on the system because"
+@unexec echo "you may be performing an update. This process can't tell."
+@unexec echo '********************************************************************'
+@unexec echo
--- munin-node-1.0.4.patch ends here ---
-- 
| lupe@lupe-christoph.de       |           http://www.lupe-christoph.de/ |
| "... putting a mail server on the Internet without filtering is like   |
| covering yourself with barbecue sauce and breaking into the Charity    |
| Home for Badgers with Rabies.                            Michael Lucas |
Comment 4 Sergey Matveychuk freebsd_committer 2004-12-14 01:46:05 UTC
State Changed
From-To: open->closed

Committed, thanks!