aboutsummaryrefslogtreecommitdiff
path: root/net-mgmt/nefu
diff options
context:
space:
mode:
authorRong-En Fan <rafan@FreeBSD.org>2009-04-07 11:49:00 +0000
committerRong-En Fan <rafan@FreeBSD.org>2009-04-07 11:49:00 +0000
commit3c2bcf7ec246614a87419deab9b0dd93dce78a2e (patch)
tree8a48811c74a8079b43199d043866643dc3b8e8ea /net-mgmt/nefu
parent2e4b118f40c2b44d0c2d48ad0071232967885480 (diff)
downloadports-3c2bcf7ec246614a87419deab9b0dd93dce78a2e.tar.gz
ports-3c2bcf7ec246614a87419deab9b0dd93dce78a2e.zip
Notes
Diffstat (limited to 'net-mgmt/nefu')
-rw-r--r--net-mgmt/nefu/Makefile35
-rw-r--r--net-mgmt/nefu/files/nefu.in30
-rw-r--r--net-mgmt/nefu/files/patch-main.c13
-rw-r--r--net-mgmt/nefu/files/patch-publish.c15
-rw-r--r--net-mgmt/nefu/pkg-deinstall70
-rw-r--r--net-mgmt/nefu/pkg-install25
6 files changed, 185 insertions, 3 deletions
diff --git a/net-mgmt/nefu/Makefile b/net-mgmt/nefu/Makefile
index 5982aa3b0e2f..27a242f00e05 100644
--- a/net-mgmt/nefu/Makefile
+++ b/net-mgmt/nefu/Makefile
@@ -7,27 +7,36 @@
PORTNAME= nefu
PORTVERSION= 1.4.0
+PORTREVISION= 1
CATEGORIES= net-mgmt
MASTER_SITES= http://rsug.itd.umich.edu/software/nefu/files/
EXTRACT_SUFX= .tgz
-MAINTAINER= ports@FreeBSD.org
+MAINTAINER= decke@bluelife.at
COMMENT= A network monitoring daemon
+USE_RC_SUBR= nefu
GNU_CONFIGURE= yes
CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \
LIBS="-L${LOCALBASE}/lib" \
YACC=${YACC} \
OPENSSL_CFLAGS="-I${OPENSSLINC}" \
OPENSSL_LIBS="-L${OPENSSLLIB} -lcrypto -lssl"
-CONFIGURE_ARGS+= --with-ssl=${OPENSSLBASE} --without-html \
+CONFIGURE_ARGS+= --with-ssl=${OPENSSLBASE} \
+ --without-sasl \
+ --without-zlib \
--without-shelltests
+NEFU_USER= nefu
+NEFU_GROUP= nefu
+
USE_OPENSSL= yes
-OPTIONS= LDAP "Enable OpenLDAP support" off
+OPTIONS= LDAP "Enable OpenLDAP support" off \
+ HTML "Enable HTML support" off
MAN1= nefu.1
MAN4= nefu.conf.4
+DBDIR= /var/db/nefu
PLIST_FILES= bin/nefu
.include <bsd.port.pre.mk>
@@ -39,15 +48,35 @@ CONFIGURE_ARGS+= --with-ldap=${LOCALBASE}/lib
CONFIGURE_ARGS+= --without-ldap
.endif
+.if defined(WITH_HTML)
+CONFIGURE_ARGS+=--with-html=${WWWDIR}
+PLIST_FILES+= "@unexec rm -rf "%D/%%WWWDIR%%" 2> /dev/null || true"
+.else
+CONFIGURE_ARGS+=--without-html
+.endif
+
post-patch:
@${REINPLACE_CMD} -e 's|-lsasl2||' \
${WRKSRC}/Makefile.in
@${REINPLACE_CMD} -e 's|-lssl|-lssl -lcrypto|' \
${WRKSRC}/configure
+ @${REINPLACE_CMD} -e 's|== x_|= x_|' \
+ ${WRKSRC}/configure
+ @${REINPLACE_CMD} -e 's|== x_|= x_|' \
+ ${WRKSRC}/libsnet/configure
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${PREFIX}/bin
${INSTALL_MAN} ${WRKSRC}/nefu.1 ${PREFIX}/man/man1
${INSTALL_MAN} ${WRKSRC}/nefu.conf.4 ${PREFIX}/man/man4
+post-install:
+ @${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
+.if defined(WITH_HTML)
+ ${MKDIR} ${WWWDIR}
+ ${CHOWN} -R ${NEFU_USER}:${NEFU_GROUP} ${WWWDIR}
+.endif
+ ${MKDIR} ${DBDIR}
+ ${CHOWN} -R ${NEFU_USER}:${NEFU_GROUP} ${DBDIR}
+
.include <bsd.port.post.mk>
diff --git a/net-mgmt/nefu/files/nefu.in b/net-mgmt/nefu/files/nefu.in
new file mode 100644
index 000000000000..06c1bbe8668f
--- /dev/null
+++ b/net-mgmt/nefu/files/nefu.in
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+# PROVIDE: nefu
+# REQUIRE: DAEMON
+# BEFORE: LOGIN
+#
+# Add the following line to /etc/rc.conf[.local] to enable nefu
+#
+# nefu_enable (bool): Set to "NO" by default.
+# Set it to "YES" to enable nefu.
+# nefu_config (str): Custom config file for nefu.
+# (default /usr/local/etc/nefu.conf)
+# nefu_flags (str): Custom additional arguments to be passed to nefu
+#
+
+. %%RC_SUBR%%
+
+name="nefu"
+rcvar=`set_rcvar`
+command=%%PREFIX%%/bin/${name}
+
+load_rc_config $name
+
+# set default
+: ${nefu_enable="NO"}
+: ${nefu_config="%%PREFIX%%/etc/nefu.conf"}
+
+command_args="-f ${nefu_config}"
+
+run_rc_command "$1"
diff --git a/net-mgmt/nefu/files/patch-main.c b/net-mgmt/nefu/files/patch-main.c
new file mode 100644
index 000000000000..f8514021c4fe
--- /dev/null
+++ b/net-mgmt/nefu/files/patch-main.c
@@ -0,0 +1,13 @@
+--- main.c 2006-11-10 20:32:33.000000000 +0100
++++ main.c 2008-06-23 20:26:45.000000000 +0200
+@@ -409,6 +409,10 @@
+ }
+ }
+
++ /* fix the html_dir */
++ if(no_html == 1)
++ nefu_html_dir = NULL;
++
+ /* initalize html pages */
+ html_init( &s );
+
diff --git a/net-mgmt/nefu/files/patch-publish.c b/net-mgmt/nefu/files/patch-publish.c
new file mode 100644
index 000000000000..7f1d3f91f253
--- /dev/null
+++ b/net-mgmt/nefu/files/patch-publish.c
@@ -0,0 +1,15 @@
+--- publish.c 2005-08-01 16:08:43.000000000 +0200
++++ publish.c 2008-06-24 14:11:41.000000000 +0200
+@@ -750,7 +750,11 @@
+ return( 1 );
+ }
+
+- return( html_plan( s ));
++ if ( nefu_html_dir != NULL ) {
++ return( html_plan( s ));
++ }
++
++ return ( 0 );
+ }
+
+
diff --git a/net-mgmt/nefu/pkg-deinstall b/net-mgmt/nefu/pkg-deinstall
new file mode 100644
index 000000000000..123ea4b8eb97
--- /dev/null
+++ b/net-mgmt/nefu/pkg-deinstall
@@ -0,0 +1,70 @@
+#! /bin/sh
+
+ask() {
+ local question default answer
+
+ question=$1
+ default=$2
+ if [ -z "${PACKAGE_BUILDING}" -a -z "${BATCH}" ]; then
+ read -p "${question} [${default}]? " answer
+ fi
+ if [ x${answer} = x ]; then
+ answer=${default}
+ fi
+ echo ${answer}
+}
+
+yesno() {
+ local dflt question answer
+
+ question=$1
+ dflt=$2
+ while :; do
+ answer=$(ask "${question}" "${dflt}")
+ case "${answer}" in
+ [Yy]*) return 0;;
+ [Nn]*) return 1;;
+ esac
+ echo "Please answer yes or no."
+ done
+}
+
+delete_account() {
+ local u g home
+
+ u=$1
+ g=$2
+ if pw group show ${g} > /dev/null 2>&1; then
+ if yesno "Do you want me to remove group \"${g}\"" y; then
+ pw group del -n ${g}
+ echo "Done."
+ else
+ GID=`pw group show ${g} | awk -F: '{ print $3 }'`
+ fi
+ fi
+ if pw user show ${u} > /dev/null 2>&1; then
+ if yesno "Do you want me to remove user \"${u}\"" y; then
+ eval home=~${u}
+ pw user del -n ${u} -r
+ echo "Done."
+ if [ -d "${home}" ]; then
+ echo "Please remember to remove the home directory \"${home}\""
+ fi
+
+ # pw user del may have removed the group, too.
+ # Put it back if the admin asked us to retain it.
+ if [ -n "$GID" ]; then
+ pw group show ${g} > /dev/null 2>&1
+ if [ $? -ne 0 ]; then
+ pw group add ${g}
+ fi
+ fi
+ fi
+ fi
+}
+
+case $2 in
+ POST-DEINSTALL)
+ delete_account nefu nefu
+ ;;
+esac
diff --git a/net-mgmt/nefu/pkg-install b/net-mgmt/nefu/pkg-install
new file mode 100644
index 000000000000..b7d05b4a62d5
--- /dev/null
+++ b/net-mgmt/nefu/pkg-install
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+case $2 in
+POST-INSTALL)
+ USER=nefu
+ GROUP=nefu
+ UID=918
+ GID=918
+
+ if pw groupshow "${GROUP}" > /dev/null 2>&1; then
+ echo "===> Using existing group ${GROUP}"
+ else
+ echo "===> Adding group ${GROUP}"
+ pw groupadd ${GROUP} -g ${GID} || exit 1
+ fi
+
+ if pw usershow "${USER}" > /dev/null 2>&1; then
+ echo "===> Using existing user ${USER}"
+ else
+ echo "===> Adding user ${USER}"
+ pw adduser ${USER} -u ${UID} -g ${GROUP} -h - -d "/var/db/nefu" \
+ -s "/sbin/nologin" -c "Nefu daemon" || exit 1
+ fi
+ ;;
+esac