diff options
author | Jun Kuriyama <kuriyama@FreeBSD.org> | 2002-09-17 02:17:09 +0000 |
---|---|---|
committer | Jun Kuriyama <kuriyama@FreeBSD.org> | 2002-09-17 02:17:09 +0000 |
commit | 87a8145c93d467a0a7c515f4618d28a0fcbc6bf4 (patch) | |
tree | 02f5edb870afc7ad38084f37c4fbfe9912dfe123 /net/net-snmp | |
parent | Upgrade to 0.11.3 (diff) |
HEADS UP: After this commit, snmpd is not enabled by default.
See pkg-message for details.
* Use /etc/rc.conf variables to control snmpd invocation.
* Add some make variables to set default values.
Requested by: many people :-)
Notes
Notes:
svn path=/head/; revision=66465
Diffstat (limited to 'net/net-snmp')
-rw-r--r-- | net/net-snmp/Makefile | 25 | ||||
-rw-r--r-- | net/net-snmp/files/snmpd.sh.sample | 18 | ||||
-rw-r--r-- | net/net-snmp/pkg-message | 23 | ||||
-rw-r--r-- | net/net-snmp/pkg-plist | 3 |
4 files changed, 60 insertions, 9 deletions
diff --git a/net/net-snmp/Makefile b/net/net-snmp/Makefile index 3591319a53cd..a44dec58eb36 100644 --- a/net/net-snmp/Makefile +++ b/net/net-snmp/Makefile @@ -7,7 +7,7 @@ PORTNAME= net-snmp PORTVERSION= 5.0.3 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= net ipv6 MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} \ ftp://sunsite.cnlab-switch.ch/mirror/ucd-snmp/ \ @@ -23,6 +23,11 @@ LIBTOOLFLAGS= --disable-ltlibs --release-ignore NO_LATEST_LINK= yes CONFIGURE_ARGS+= --enable-shared --with-mib-modules="host ucd-snmp/diskio" \ + --with-default-snmp-version="${DEFAULT_SNMP_VERSION}" \ + --with-sys-contact="${NET_SNMP_SYS_CONTACT}" \ + --with-sys-location="${NET_SNMP_SYS_LOCATION}" \ + --with-logfile="${NET_SNMP_LOGFILE}" \ + --with-persistent-directory="${NET_SNMP_PERSISTENTDIR}" \ --with-gnu-ld --with-libwrap --with-libs="-lkvm -ldevstat" .if defined(BATCH) CONFIGURE_ARGS+= --with-defaults --with-sys-contact=nobody@no.where @@ -30,6 +35,12 @@ CONFIGURE_ARGS+= --with-defaults --with-sys-contact=nobody@no.where IS_INTERACTIVE= yes .endif +DEFAULT_SNMP_VERSION?= 3 +NET_SNMP_SYS_CONTACT?= nobody@no.where +NET_SNMP_SYS_LOCATION?= +NET_SNMP_LOGFILE?= /var/log/snmpd.log +NET_SNMP_PERSISTENTDIR?=/var/net-snmp + MAN1= mib2c.1 \ snmpbulkget.1 snmpbulkwalk.1 snmpcmd.1 snmpconf.1 snmpd.1 \ snmpdelta.1 snmpdf.1 snmpget.1 snmpgetnext.1 snmpinform.1 \ @@ -81,15 +92,17 @@ PLIST_SUB+= shlib=${SHLIB_VERSION} post-patch: @${PERL} -pi -e "s|%%LOCALBASE%%|${LOCALBASE}|g" ${WRKSRC}/aclocal.m4 +pre-install: + -@[ -f ${STARTUP_FILE} ] && \ + (echo "Remove old ${STARTUP_FILE} before install." && exit 1) + post-install: @( cd ${PREFIX}/bin && ${STRIP_CMD} ${BIN} ) @( cd ${PREFIX}/sbin && ${STRIP_CMD} ${SBIN} ) @${FIND} ${PREFIX}/include/net-snmp ${PREFIX}/share/snmp/mibs -type f \ | ${XARGS} ${CHMOD} 644 - @${INSTALL_SCRIPT} -m 751 ${FILESDIR}/snmpd.sh.sample ${PREFIX}/etc/rc.d - @if [ ! -f ${STARTUP_FILE} ]; then \ - ${ECHO} "Creating ${PREFIX}/etc/rc.d/snmpd.sh startup file."; \ - ${INSTALL_SCRIPT} -m 751 ${FILESDIR}/snmpd.sh.sample ${STARTUP_FILE}; \ - fi + @${INSTALL_SCRIPT} -m 751 ${FILESDIR}/snmpd.sh.sample ${STARTUP_FILE} + @${ECHO_MSG} + @${CAT} ${PKGMESSAGE} .include <bsd.port.post.mk> diff --git a/net/net-snmp/files/snmpd.sh.sample b/net/net-snmp/files/snmpd.sh.sample index 71f8b504ce81..a626c9b9e26e 100644 --- a/net/net-snmp/files/snmpd.sh.sample +++ b/net/net-snmp/files/snmpd.sh.sample @@ -1,13 +1,29 @@ #!/bin/sh +# +# $FreeBSD$ if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then echo "$0: Cannot determine the PREFIX" >&2 exit 1 fi +if [ -z "${source_rc_confs_defined}" ]; then + if [ -r /etc/defaults/rc.conf ]; then + . /etc/defaults/rc.conf + source_rc_confs + elif [ -r /etc/rc.conf ]; then + . /etc/rc.conf + fi +fi + case "$1" in start) - [ -x ${PREFIX}/sbin/snmpd ] && ${PREFIX}/sbin/snmpd && echo -n ' snmpd' + case "${net_snmpd_enable}" in + [Yy][Ee][Ss]) + echo -n ' snmpd' + ${net_snmpd_program:-${PREFIX}/sbin/snmpd} ${net_snmpd_flags} + ;; + esac ;; stop) killall snmpd && echo -n ' snmpd' diff --git a/net/net-snmp/pkg-message b/net/net-snmp/pkg-message new file mode 100644 index 000000000000..c33cc3a65658 --- /dev/null +++ b/net/net-snmp/pkg-message @@ -0,0 +1,23 @@ +**** This port installs snmp daemon, include files and libraries but not + invoking snmpd by default. + If you want to invoke snmpd from startup, put these lines into + /etc/rc.conf. + + net_snmpd_enable="YES" + net_snmpd_flags="" + +**** You can specify make variables as: + + NET_SNMP_SYS_CONTACT="kuriyama@FreeBSD.org" + NET_SNMP_SYS_LOCATION="Tokyo, Japan" + DEFAULT_SNMP_VERSION=3 + NET_SNMP_LOGFILE=/var/log/snmpd.log + NET_SNMP_PERSISTENTDIR=/var/net-snmp + + to define default values (or overwriting defaults). At least + setting first two variables, you will not be prompted during + configuration process. Or you can set + + BATCH="yes" + + to make to avoid interactive configuration.
\ No newline at end of file diff --git a/net/net-snmp/pkg-plist b/net/net-snmp/pkg-plist index 3c575e05d2ca..8c7ef94d8d3d 100644 --- a/net/net-snmp/pkg-plist +++ b/net/net-snmp/pkg-plist @@ -23,8 +23,7 @@ bin/snmpusm bin/snmpvacm bin/snmpwalk bin/traptoemail -@unexec if cmp -s %D/etc/snmpd.sh %D/etc/snmpd.sh.sample; then rm -f %D/etc/snmpd.sh; fi -etc/rc.d/snmpd.sh.sample +etc/rc.d/snmpd.sh include/net-snmp/agent/agent_callbacks.h include/net-snmp/agent/agent_handler.h include/net-snmp/agent/agent_index.h |