Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Sep 2005 15:12:05 +0200 (CEST)
From:      Blaz Zupan <blaz@si.FreeBSD.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/86459: Update net-mgmt/snmptt to 1.0 
Message-ID:  <200509221312.j8MDC5Kh051547@titanic.medinet.si>
Resent-Message-ID: <200509221320.j8MDK1hM001221@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         86459
>Category:       ports
>Synopsis:       Update net-mgmt/snmptt to 1.0
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Thu Sep 22 13:20:01 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Blaz Zupan
>Release:        FreeBSD 5.4-RELEASE i386
>Organization:
>Environment:

	
>Description:

This patch has been sent directly to the maintainer on August 27th. A month
has passed and I have received no reply, so I'm sending it in as a PR.

The snmptt port is currently at version 0.9. Version 1.0 has been released
more then a year ago and it fixes (among others) a nasty problem with
logging to MySQL databases.

I have created a patch that updates the port to 1.0. I have also taken the
freedom to do some other fixes on the port.

On deinstallation, the port unconditionally deleted the snmptt.ini file,
which is bad for the user who has changed the configuration. Same goes for
the snmptt.conf.generic file. Also, the sample snmptt.ini contains the wrong
path to the snmptt.conf.generic file.

I have also removed the installation of the rc script to /etc/rc.d on
FreeBSD 5.x. It is completely unneccesary for this port, as it does not
depend on any other service running. The startup script is now installed to
/usr/local/etc/rc.d.

Also, because the user might want to create many snmptt.conf.XXXX files, it
is better to install the configuration files to /usr/local/etc/snmptt, so
they don't clutter up the general /usr/local/etc directory.

Below is the patch. Please review it and commit if you think it is ok. 

>How-To-Repeat:
	
>Fix:

diff -urN snmptt.orig/Makefile snmptt/Makefile
--- snmptt.orig/Makefile	Mon May 24 20:41:01 2004
+++ snmptt/Makefile	Sat Aug 27 13:25:56 2005
@@ -6,7 +6,7 @@
 #
 
 PORTNAME=		snmptt
-PORTVERSION=		0.9
+PORTVERSION=		1.0
 CATEGORIES=		net-mgmt
 MASTER_SITES=		${MASTER_SITE_SOURCEFORGE}
 MASTER_SITE_SUBDIR=	${PORTNAME}
@@ -26,9 +26,8 @@
 DOCS=		faqs.html index.html layout1.css snmptt.html \
 		snmpttconvert.html snmpttconvertmib.html
 
-RUN_DEPENDS+=	\
-	${SITE_PERL}/${PERL_ARCH}/SNMP.pm:${PORTSDIR}/net-mgmt/net-snmp \
-	${SITE_PERL}/Config/IniFiles.pm:${PORTSDIR}/devel/p5-Config-IniFiles
+RUN_DEPENDS+=	${SITE_PERL}/${PERL_ARCH}/SNMP.pm:${PORTSDIR}/net-mgmt/net-snmp \
+		${SITE_PERL}/Config/IniFiles.pm:${PORTSDIR}/devel/p5-Config-IniFiles
 
 SED_SCRIPT=	-e 's,%%PREFIX%%,${PREFIX},g' \
 		-e 's,%%RC_SUBR%%,${RC_SUBR},g' \
@@ -40,31 +39,33 @@
 
 .include <bsd.port.pre.mk>
 
-.if ${OSVERSION} >= 500038
-RC_SUBR?=	${DESTDIR}/etc/rc.subr
-RC_DIR=		${DESTDIR}/etc/rc.d
-RC_SUFX=
-.else
 USE_RC_SUBR=	yes
 RC_DIR=		${PREFIX}/etc/rc.d
 RC_SUFX=	.sh
-.endif
 
 do-build:
 
 post-build:
 	@${SED} ${SED_SCRIPT} ${FILESDIR}/snmptt.sh > ${WRKDIR}/snmptt.sh
-	@${ECHO_CMD} ${WRKSRC}/snmptt ${WRKSRC}/snmptthandler | ${XARGS} \
+	@${ECHO_CMD} ${WRKSRC}/snmptt ${WRKSRC}/snmptthandler ${WRKSRC}/snmptt.ini | ${XARGS} \
 	 ${REINPLACE_CMD} -e \
 	 "s|/etc/snmptt.ini|${PREFIX}/etc/snmptt.ini|g ; \
-	  s|/etc/snmp/snmptt.ini|${PREFIX}/etc/snmp/snmptt.ini|g"
+	  s|/etc/snmp/snmptt.ini|${PREFIX}/etc/snmp/snmptt.ini|g ; \
+	  s|/etc/snmp/snmptt.conf|${PREFIX}/etc/snmp/snmptt.conf.generic|g"
 
 do-install:
 .for _SCRIPT in ${SCRIPTS}
 	${INSTALL_SCRIPT} ${WRKSRC}/${_SCRIPT} ${PREFIX}/sbin
 .endfor
-	${INSTALL_DATA} ${WRKSRC}/snmptt.ini ${PREFIX}/etc
-	${INSTALL_DATA} ${WRKSRC}/examples/snmptt.conf.generic ${PREFIX}/etc
+	${MKDIR} ${PREFIX}/etc/snmp
+	${INSTALL_DATA} ${WRKSRC}/snmptt.ini ${PREFIX}/etc/snmp/snmptt.ini-dist
+.if !exists(${PREFIX}/etc/snmp/snmptt.ini)
+	${INSTALL_DATA} ${WRKSRC}/snmptt.ini ${PREFIX}/etc/snmp
+.endif
+	${INSTALL_DATA} ${WRKSRC}/examples/snmptt.conf.generic ${PREFIX}/etc/snmp/snmptt.conf.generic-dist
+.if !exists(${PREFIX}/etc/snmp/snmptt.conf)
+	${INSTALL_DATA} ${WRKSRC}/examples/snmptt.conf.generic ${PREFIX}/etc/snmp/snmptt.conf.generic
+.endif
 .if !defined(NOPORTDOCS)
 	${MKDIR} ${DOCSDIR}
 .for _DOC in ${DOCS}
diff -urN snmptt.orig/distinfo snmptt/distinfo
--- snmptt.orig/distinfo	Mon May 24 20:41:01 2004
+++ snmptt/distinfo	Sat Aug 27 13:25:56 2005
@@ -1,2 +1,2 @@
-MD5 (snmptt_0.9.tgz) = 85090dee54ed5772c4e6ec939d954271
-SIZE (snmptt_0.9.tgz) = 107679
+MD5 (snmptt_1.0.tgz) = ad93fc3d7b28eb59c153ce2761644838
+SIZE (snmptt_1.0.tgz) = 110663
diff -urN snmptt.orig/files/snmptt.sh snmptt/files/snmptt.sh
--- snmptt.orig/files/snmptt.sh	Mon May 24 20:41:01 2004
+++ snmptt/files/snmptt.sh	Sat Aug 27 13:25:56 2005
@@ -21,13 +21,13 @@
 rcvar=`set_rcvar`
 
 command=%%PREFIX%%/sbin/${name}
-command_args="--daemon"
+command_args=">/dev/null --daemon"
 pidfile=/var/run/${name}.pid
 # XXX: Makes assumptions about the interpreter path and version. However,
 # USE_PERL5 should guarantee that this path is valid. In any event, we
 # don't sed-ify the #! operators.
 procname=/usr/bin/perl
-required_files=%%PREFIX%%/etc/${name}.ini
+required_files=%%PREFIX%%/etc/snmp/${name}.ini
 
 # set defaults
 
diff -urN snmptt.orig/pkg-plist snmptt/pkg-plist
--- snmptt.orig/pkg-plist	Mon May 24 20:41:01 2004
+++ snmptt/pkg-plist	Sat Aug 27 13:25:56 2005
@@ -3,8 +3,13 @@
 sbin/snmpttconvert
 sbin/snmpttconvertmib
 sbin/snmptthandler
-etc/snmptt.ini
-etc/snmptt.conf.generic
+@unexec if cmp -s %D/etc/snmp/snmptt.ini %D/etc/snmp/snmptt.ini-dist; then rm -f %D/etc/snmp/snmptt.ini; fi
+etc/snmp/snmptt.ini-dist
+@exec [ ! -f %B/snmptt.ini ] && cp %B/%f %B/snmptt.ini
+@unexec if cmp -s %D/etc/snmp/snmptt.conf.generic %D/etc/snmp/snmptt.conf.generic-dist; then rm -f %D/etc/snmp/snmptt.conf.generic; fi
+etc/snmp/snmptt.conf.generic-dist
+@exec [ ! -f %B/snmptt.conf.generic ] && cp %B/%f %B/snmptt.conf.generic
+@unexec rmdir %D/etc/snmp 2>/dev/null || true
 %%PORTDOCS%%%%DOCSDIR%%/faqs.html
 %%PORTDOCS%%%%DOCSDIR%%/index.html
 %%PORTDOCS%%%%DOCSDIR%%/layout1.css

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200509221312.j8MDC5Kh051547>