aboutsummaryrefslogtreecommitdiffstats
path: root/net-mgmt
diff options
context:
space:
mode:
authorgarga <garga@FreeBSD.org>2017-04-25 21:10:30 +0800
committergarga <garga@FreeBSD.org>2017-04-25 21:10:30 +0800
commit88f5effabf75eff1653c682275a24874f18e0cae (patch)
tree70376b33eb135e076b25ad1569991c65b467a6be /net-mgmt
parenta6aadd1c7597d6fc812f944e374eb8d7412d5d29 (diff)
downloadfreebsd-ports-gnome-88f5effabf75eff1653c682275a24874f18e0cae.tar.gz
freebsd-ports-gnome-88f5effabf75eff1653c682275a24874f18e0cae.tar.zst
freebsd-ports-gnome-88f5effabf75eff1653c682275a24874f18e0cae.zip
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
Diffstat (limited to 'net-mgmt')
-rw-r--r--net-mgmt/snmptt/Makefile45
-rw-r--r--net-mgmt/snmptt/files/newsyslog-snmptt.conf10
-rw-r--r--net-mgmt/snmptt/files/snmptt.in33
-rw-r--r--net-mgmt/snmptt/pkg-plist11
4 files changed, 54 insertions, 45 deletions
diff --git a/net-mgmt/snmptt/Makefile b/net-mgmt/snmptt/Makefile
index 3b4a0de09d88..5094037eff55 100644
--- a/net-mgmt/snmptt/Makefile
+++ b/net-mgmt/snmptt/Makefile
@@ -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 snmpttconvert \
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>
diff --git a/net-mgmt/snmptt/files/newsyslog-snmptt.conf b/net-mgmt/snmptt/files/newsyslog-snmptt.conf
new file mode 100644
index 000000000000..c947b1880a50
--- /dev/null
+++ b/net-mgmt/snmptt/files/newsyslog-snmptt.conf
@@ -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
diff --git a/net-mgmt/snmptt/files/snmptt.in b/net-mgmt/snmptt/files/snmptt.in
index 61860e7dbd18..5a811a82cab0 100644
--- a/net-mgmt/snmptt/files/snmptt.in
+++ b/net-mgmt/snmptt/files/snmptt.in
@@ -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"
diff --git a/net-mgmt/snmptt/pkg-plist b/net-mgmt/snmptt/pkg-plist
index 0794e9b7cf9b..ce0664316ae0 100644
--- a/net-mgmt/snmptt/pkg-plist
+++ b/net-mgmt/snmptt/pkg-plist
@@ -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