mirror of
https://git.FreeBSD.org/ports.git
synced 2025-01-23 09:10:43 +00:00
- Use fix uid and gid
- Fix broken --without-html with patches - Add OPTIONS for HTML - Add rc script - Pass maintainership to submitter PR: ports/126787 Submitted by: decke at bluelife.at
This commit is contained in:
parent
2e4b118f40
commit
3c2bcf7ec2
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=231770
@ -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>
|
||||
|
30
net-mgmt/nefu/files/nefu.in
Normal file
30
net-mgmt/nefu/files/nefu.in
Normal file
@ -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"
|
13
net-mgmt/nefu/files/patch-main.c
Normal file
13
net-mgmt/nefu/files/patch-main.c
Normal file
@ -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 );
|
||||
|
15
net-mgmt/nefu/files/patch-publish.c
Normal file
15
net-mgmt/nefu/files/patch-publish.c
Normal file
@ -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 );
|
||||
}
|
||||
|
||||
|
70
net-mgmt/nefu/pkg-deinstall
Normal file
70
net-mgmt/nefu/pkg-deinstall
Normal file
@ -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
|
25
net-mgmt/nefu/pkg-install
Normal file
25
net-mgmt/nefu/pkg-install
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user