- Add USES=libtool

- Add INSTALL_TARGET=install-strip
- Replace pkg-install and pkg-deinstall with USERS, GROUPS and pkg-plist
  commands
- Use ETCDIR
This commit is contained in:
Tijl Coosemans 2014-07-09 11:13:29 +00:00
parent e0ab20bcac
commit 9b95abf4da
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=361352
4 changed files with 40 additions and 149 deletions

View file

@ -3,6 +3,7 @@
PORTNAME= flow-tools
PORTVERSION= 0.68.5.1
PORTREVISION= 1
CATEGORIES= net-mgmt
MASTER_SITES= ${MASTER_SITE_GOOGLE_CODE}
PKGNAMESUFFIX= -ng
@ -25,39 +26,34 @@ OPENSSL_USE= OPENSSL=yes
CONFLICTS= flow-tools-[0-9]*
USES= gmake tar:bzip2
USES= gmake libtool tar:bzip2
USE_LDCONFIG= yes
USE_PYTHON_RUN= yes
GNU_CONFIGURE= yes
CONFIGURE_ARGS+=--localstatedir="${PREFIX}"
USE_LDCONFIG= Yes
INSTALL_TARGET= install-strip
SUB_FILES= pkg-install pkg-deinstall
PLIST_SUB= RESETPREFIX=${PREFIX}
SUB_LIST= FLOW_CAPTURE_SPOOL="${FLOW_CAPTURE_SPOOL}" \
FLOW_CAPTURE_USER="${FLOW_CAPTURE_USER}" \
FLOW_CAPTURE_GROUP="${FLOW_CAPTURE_GROUP}" \
FLOW_CAPTURE_UID="${FLOW_CAPTURE_UID}" \
FLOW_CAPTURE_GID="${FLOW_CAPTURE_GID}" \
FLOW_CAPTURE_PIDDIR="${FLOW_CAPTURE_PIDDIR}"
USE_RC_SUBR= flow_capture flow_fanout
VARDIR?= /var
FLOW_CAPTURE_SPOOL= ${VARDIR}/db/flows
FLOW_CAPTURE_USER= flowtools
FLOW_CAPTURE_GROUP= flowtools
FLOW_CAPTURE_UID= 174
FLOW_CAPTURE_GID= 174
FLOW_CAPTURE_PIDDIR= ${VARDIR}/run/flow-capture
FLOW_CAPTURE_SPOOL= /var/db/flows
FLOW_CAPTURE_PIDDIR= /var/run/flow-capture
USERS= flowtools
GROUPS= flowtools
post-patch:
@${REINPLACE_CMD}\
-e 's|@sysconfdir@/sym/|${PREFIX}/share/flow-tools/|' \
-e 's|@sysconfdir@/cfg/|${PREFIX}/etc/flow-tools/|' \
-e 's|@sysconfdir@/sym/|${ETCDIR}/|' \
-e 's|@sysconfdir@/cfg/|${ETCDIR}/|' \
${WRKSRC}/docs/flow-*.1.in ${WRKSRC}/docs/flow-*.html.in
@${REINPLACE_CMD} -e 's|!/bin/env|!/usr/bin/env|' \
${WRKSRC}/bin/* ${WRKSRC}/utils/*
post-install:
${MKDIR} ${STAGEDIR}${FLOW_CAPTURE_SPOOL}
${MKDIR} ${STAGEDIR}${FLOW_CAPTURE_PIDDIR}
${INSTALL_MAN} ${WRKSRC}/docs/*.1 ${STAGEDIR}${PREFIX}/man/man1/
${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/libft.so.0
.include <bsd.port.mk>

View file

@ -1,37 +0,0 @@
#!/bin/sh
#
# $FreeBSD$
#
PATH=/bin:/usr/sbin:/usr/bin:/usr/sbin
FLOW_CAPTURE_SPOOL="%%FLOW_CAPTURE_SPOOL%%"
FLOW_CAPTURE_USER="%%FLOW_CAPTURE_USER%%"
FLOW_CAPTURE_GROUP="%%FLOW_CAPTURE_GROUP%%"
FLOW_CAPTURE_PIDDIR="%%FLOW_CAPTURE_PIDDIR%%"
post-deinstall() {
rmdir ${FLOW_CAPTURE_SPOOL} > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "WARNING: If you will NOT use this package anymore, please"
echo " remove the following directory manually:"
echo " ${FLOW_CAPTURE_SPOOL}"
echo
echo "Also flow-tools related user accounts and groups were not"
echo "removed (${FLOW_CAPTURE_USER}:${FLOW_CAPTURE_GROUP})."
echo "Do it manually, if needed."
echo
fi
#
# Remove pid directory
#
rm -rf ${FLOW_CAPTURE_PIDDIR} > /dev/null 2>&1
}
case $2 in
POST-DEINSTALL)
post-deinstall
;;
esac

View file

@ -1,81 +0,0 @@
#!/bin/sh
#
# $FreeBSD$
#
PATH=/bin:/usr/sbin:/usr/bin:/usr/sbin
FLOW_CAPTURE_SPOOL="%%FLOW_CAPTURE_SPOOL%%"
FLOW_CAPTURE_USER="%%FLOW_CAPTURE_USER%%"
FLOW_CAPTURE_GROUP="%%FLOW_CAPTURE_GROUP%%"
FLOW_CAPTURE_UID="%%FLOW_CAPTURE_UID%%"
FLOW_CAPTURE_GID="%%FLOW_CAPTURE_GID%%"
FLOW_CAPTURE_PIDDIR="%%FLOW_CAPTURE_PIDDIR%%"
if [ -x /usr/sbin/nologin ]; then
NOLOGIN=/usr/sbin/nologin
else
NOLOGIN=/sbin/nologin
fi
pre-install() {
#
# Create group
#
pw groupshow ${FLOW_CAPTURE_GROUP} > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo -n "Creating '${FLOW_CAPTURE_GROUP}' group... "
pw groupadd -n ${FLOW_CAPTURE_GROUP} -g ${FLOW_CAPTURE_GID} -q
if [ $? -eq 0 ]; then
echo "ok"
else
echo "failed"
echo "Cannot create group '${FLOW_CAPTURE_GROUP}'" >&2
echo "Please, create it manually." >&2
exit 1
fi
else
echo "Using existing group '${FLOW_CAPTURE_GROUP}'"
fi
#
# Create user
#
pw usershow ${FLOW_CAPTURE_USER} > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo -n "Creating '${FLOW_CAPTURE_USER}' user... "
pw useradd -n ${FLOW_CAPTURE_USER} -g ${FLOW_CAPTURE_GROUP} \
-u ${FLOW_CAPTURE_UID} \
-c "Flow-tools collector pseudo-user" \
-d "/var/empty" -s "${NOLOGIN}" -h - -q
if [ $? -eq 0 ]; then
echo "ok"
else
echo "failed"
echo "Cannot create user '${FLOW_CAPTURE_USER}'" >&2
echo "Please, create it manually." >&2
exit 1
fi
else
echo "Using existing group '${FLOW_CAPTURE_USER}'"
fi
}
post-install() {
/usr/bin/install -d -m 700 -o ${FLOW_CAPTURE_USER} \
-g ${FLOW_CAPTURE_GROUP} ${FLOW_CAPTURE_PIDDIR}
/usr/bin/install -d -m 1700 -o ${FLOW_CAPTURE_USER} \
-g ${FLOW_CAPTURE_GROUP} ${FLOW_CAPTURE_SPOOL}
}
case $2 in
PRE-INSTALL)
pre-install
;;
POST-INSTALL)
post-install
;;
esac

View file

@ -22,23 +22,23 @@ bin/flow-split
bin/flow-stat
bin/flow-tag
bin/flow-xlate
etc/flow-tools/asn.sym
etc/flow-tools/filter.cfg
etc/flow-tools/ip-prot.sym
etc/flow-tools/ip-type.sym
etc/flow-tools/map.cfg
etc/flow-tools/mask.cfg
etc/flow-tools/stat.cfg
etc/flow-tools/tag.cfg
etc/flow-tools/tag.sym
etc/flow-tools/tcp-port.sym
etc/flow-tools/xlate.cfg
%%ETCDIR%%/asn.sym
%%ETCDIR%%/filter.cfg
%%ETCDIR%%/ip-prot.sym
%%ETCDIR%%/ip-type.sym
%%ETCDIR%%/map.cfg
%%ETCDIR%%/mask.cfg
%%ETCDIR%%/stat.cfg
%%ETCDIR%%/tag.cfg
%%ETCDIR%%/tag.sym
%%ETCDIR%%/tcp-port.sym
%%ETCDIR%%/xlate.cfg
include/ftlib.h
include/ftqueue.h
lib/libft.a
lib/libft.la
lib/libft.so
lib/libft.so.0
lib/libft.so.0.0.0
man/man1/flow-capture.1.gz
man/man1/flow-cat.1.gz
man/man1/flow-dscan.1.gz
@ -70,4 +70,17 @@ man/man1/flow-rpt2rrd.1.gz
%%DATADIR%%/gprot
%%DATADIR%%/gserv
@dirrmtry %%DATADIR%%
@dirrmtry etc/flow-tools
@dirrmtry %%ETCDIR%%
@cwd /var
@exec install -d -o flowtools -g flowtools -m 1700 %D/db/flows
@exec install -d -o flowtools -g flowtools -m 700 %D/run/flow-capture
@owner flowtools
@group flowtools
@mode 700
@dirrmtry run/flow-capture
@mode 1700
@dirrmtry db/flows
@owner
@group
@mode
@cwd %%RESETPREFIX%%