Date: Tue, 25 Apr 2017 13:10:30 +0000 (UTC) From: Renato Botelho <garga@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r439381 - in head: . net-mgmt/snmptt net-mgmt/snmptt/files Message-ID: <201704251310.v3PDAU0Q082964@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: garga Date: Tue Apr 25 13:10:30 2017 New Revision: 439381 URL: https://svnweb.freebsd.org/changeset/ports/439381 Log: Modernizing port, several improvements were done: * Use options helpers * Create user/group * Create necessary directories * Remove unnecessary dependencies * Add newsyslog conf * Pet portlint * Bump PORTREVISION PR: 218509 Submitted by: Danilo G. Baio (dbaio) <dbaio@bsd.com.br> Approved by: nistor@snickers.org (maintainer) Sponsored by: Rubicon Communications (Netgate) Differential Revision: https://reviews.freebsd.org/D10312 Added: head/net-mgmt/snmptt/files/newsyslog-snmptt.conf (contents, props changed) Modified: head/GIDs head/UIDs head/net-mgmt/snmptt/Makefile head/net-mgmt/snmptt/files/snmptt.in head/net-mgmt/snmptt/pkg-plist Modified: head/GIDs ============================================================================== --- head/GIDs Tue Apr 25 12:59:47 2017 (r439380) +++ head/GIDs Tue Apr 25 13:10:30 2017 (r439381) @@ -836,7 +836,7 @@ chronyd:*:849: # free: 892 # free: 893 # free: 894 -# free: 895 +snmptt:*:895: istat:*:896: znc:*:897: ufdb:*:898: Modified: head/UIDs ============================================================================== --- head/UIDs Tue Apr 25 12:59:47 2017 (r439380) +++ head/UIDs Tue Apr 25 13:10:30 2017 (r439381) @@ -841,7 +841,7 @@ chronyd:*:849:849::0:0:chronyd user:/non # free: 892 # free: 893 # free: 894 -# free: 895 +snmptt:*:895:895::0:0:SNMPTT User:/var/spool/snmptt:/usr/sbin/nologin istat:*:896:896::0:0:istatserver user:/nonexistent:/usr/sbin/nologin znc:*:897:897::0:0:ZNC User:/nonexistent:/usr/sbin/nologin ufdb:*:898:898::0:0:ufdb user:/nonexistent:/usr/sbin/nologin Modified: head/net-mgmt/snmptt/Makefile ============================================================================== --- head/net-mgmt/snmptt/Makefile Tue Apr 25 12:59:47 2017 (r439380) +++ head/net-mgmt/snmptt/Makefile Tue Apr 25 13:10:30 2017 (r439381) @@ -2,6 +2,7 @@ PORTNAME= snmptt PORTVERSION= 1.4 +PORTREVISION= 1 CATEGORIES= net-mgmt MASTER_SITES= SF/${PORTNAME}/${PORTNAME}/${PORTNAME}_${PORTVERSION} DISTNAME= ${PORTNAME}_${PORTVERSION} @@ -9,21 +10,24 @@ DISTNAME= ${PORTNAME}_${PORTVERSION} MAINTAINER= nistor@snickers.org COMMENT= SNMP trap handler/translator/swiss-army-knife -NO_BUILD= yes LICENSE= GPLv2 +LICENSE_FILE= ${WRKSRC}/COPYING + +RUN_DEPENDS= net-snmp>=0:net-mgmt/net-snmp \ + p5-Config-IniFiles>=0:devel/p5-Config-IniFiles +NO_BUILD= yes +NO_ARCH= yes USES= perl5 shebangfix tar:tgz USE_RC_SUBR= snmptt +SUB_LIST= PERL=${PERL} -RUN_DEPENDS= net-snmp>=0:net-mgmt/net-snmp \ - p5-Config-IniFiles>=0:devel/p5-Config-IniFiles \ - p5-Text-Balanced>=0:textproc/p5-Text-Balanced \ - p5-Text-ParseWords>=0:textproc/p5-Text-ParseWords \ - p5-Time-HiRes>=0:devel/p5-Time-HiRes - -DOCS= faqs.html index.html layout1.css snmptt.html \ +PORTDOCS= faqs.html index.html layout1.css snmptt.html \ snmpttconvert.html snmpttconvertmib.html +USERS= snmptt +GROUPS= snmptt + OPTIONS_DEFINE= DOCS SCRIPTS= snmptt snmptt-net-snmp-test snmpttconvert \ @@ -31,19 +35,24 @@ SCRIPTS= snmptt snmptt-net-snmp-test snm SHEBANG_FILES= ${SCRIPTS} +post-patch: + ${REINPLACE_CMD} -e "s|/var/run|/var/run/${PORTNAME}|" \ + -e "s|/etc|${PREFIX}/etc|" ${WRKSRC}/snmptt.ini do-install: -.for _SCRIPT in ${SCRIPTS} - @${INSTALL_SCRIPT} ${WRKSRC}/${_SCRIPT} ${STAGEDIR}${PREFIX}/sbin -.endfor - + cd ${WRKSRC} && ${INSTALL_SCRIPT} ${SCRIPTS} ${STAGEDIR}${PREFIX}/sbin ${MKDIR} ${STAGEDIR}${PREFIX}/etc/snmp ${INSTALL_DATA} ${WRKSRC}/snmptt.ini ${STAGEDIR}${PREFIX}/etc/snmp/snmptt.ini.sample - ${INSTALL_DATA} ${WRKSRC}/examples/snmptt.conf.generic ${STAGEDIR}${PREFIX}/etc/snmp/snmptt.conf.generic.sample - - ${MKDIR} ${STAGEDIR}${DOCSDIR} -.for _DOC in ${DOCS} - ${INSTALL_MAN} ${WRKSRC}/docs/${_DOC} ${STAGEDIR}${DOCSDIR} -.endfor + ${INSTALL_DATA} ${WRKSRC}/examples/snmptt.conf.generic \ + ${STAGEDIR}${PREFIX}/etc/snmp/snmptt.conf.generic.sample + ${INSTALL_DATA} ${FILESDIR}/newsyslog-snmptt.conf \ + ${STAGEDIR}${PREFIX}/etc/snmp/newsyslog-snmptt.conf.sample + @${MKDIR} ${STAGEDIR}/var/log/${PORTNAME} + @${MKDIR} ${STAGEDIR}/var/run/${PORTNAME} + @${MKDIR} ${STAGEDIR}/var/spool/${PORTNAME} + +do-install-DOCS-on: + @${MKDIR} ${STAGEDIR}${DOCSDIR} + cd ${WRKSRC}/docs && ${INSTALL_DATA} ${PORTDOCS} ${STAGEDIR}${DOCSDIR} .include <bsd.port.mk> Added: head/net-mgmt/snmptt/files/newsyslog-snmptt.conf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net-mgmt/snmptt/files/newsyslog-snmptt.conf Tue Apr 25 13:10:30 2017 (r439381) @@ -0,0 +1,10 @@ +# configuration file for newsyslog for snmptt +# +# see newsyslog.conf(5) for details +# +# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num] +/var/log/snmptt/snmptt.debug snmptt:snmptt 644 3 1024 * JC /var/run/snmptt/snmptt.pid +/var/log/snmptt/snmptt.log snmptt:snmptt 644 3 * $W6D0 JC +/var/log/snmptt/snmptthandler.debug snmptt:snmptt 644 3 1024 * JC +/var/log/snmptt/snmpttunknown.log snmptt:snmptt 644 3 1024 * JC +/var/log/snmptt/snmpttsystem.log snmptt:snmptt 644 3 1024 * JC Modified: head/net-mgmt/snmptt/files/snmptt.in ============================================================================== --- head/net-mgmt/snmptt/files/snmptt.in Tue Apr 25 12:59:47 2017 (r439380) +++ head/net-mgmt/snmptt/files/snmptt.in Tue Apr 25 13:10:30 2017 (r439381) @@ -9,36 +9,27 @@ # # Add the following lines to /etc/rc.conf to enable snmptt: # -# snmptt_enable="YES" -# snmptt_flags="<set as needed>" -# -# See snmptt documentation for flags. +# snmptt_enable: Set to NO by default. Set it to YES to enable it. +# snmptt_user: The user account snmptt runs as what +# you want it to be. It uses 'snmptt' user by +# default. +# snmptt_flags: See snmptt documentation for flags. # . /etc/rc.subr name=snmptt -rcvar=snmptt_enable +rcvar=${name}_enable command=%%PREFIX%%/sbin/${name} -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/snmp/${name}.ini - -# set defaults +command_args="--daemon > /dev/null 2>&1" +command_interpreter=%%PERL%% -snmptt_enable=${snmptt_enable:-"NO"} +load_rc_config ${name} -stop_postcmd=stop_postcmd +: ${snmptt_enable:="NO"} +: ${snmptt_user:="snmptt"} -stop_postcmd() -{ - rm -f $pidfile -} +required_files=%%PREFIX%%/etc/snmp/${name}.ini -load_rc_config ${name} run_rc_command "$1" Modified: head/net-mgmt/snmptt/pkg-plist ============================================================================== --- head/net-mgmt/snmptt/pkg-plist Tue Apr 25 12:59:47 2017 (r439380) +++ head/net-mgmt/snmptt/pkg-plist Tue Apr 25 13:10:30 2017 (r439381) @@ -1,3 +1,4 @@ +@sample etc/snmp/newsyslog-snmptt.conf.sample etc/newsyslog.conf.d/snmptt.conf @sample etc/snmp/snmptt.conf.generic.sample @sample etc/snmp/snmptt.ini.sample sbin/snmptt @@ -5,9 +6,7 @@ sbin/snmptt-net-snmp-test sbin/snmpttconvert sbin/snmpttconvertmib sbin/snmptthandler -%%DOCSDIR%%/faqs.html -%%DOCSDIR%%/index.html -%%DOCSDIR%%/layout1.css -%%DOCSDIR%%/snmptt.html -%%DOCSDIR%%/snmpttconvert.html -%%DOCSDIR%%/snmpttconvertmib.html +%%PORTDOCS%%@dir %%DOCSDIR%% +@dir(snmptt,snmptt,775) /var/log/snmptt +@dir(snmptt,snmptt,775) /var/run/snmptt +@dir(snmptt,snmptt,700) /var/spool/snmptt
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201704251310.v3PDAU0Q082964>