Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Dec 2010 17:05:49 +0100 (CET)
From:      olli hauer <ohauer@FreeBSD.org>
To:        <FreeBSD-gnats-submit@FreeBSD.org>
Cc:        janos.mohacsi@bsd.hu
Subject:   ports/153310: [patch] port net-mgmt/flowd register _flowd user in ports/UIDs/GIDs, add additional MASTER_SITE and more
Message-ID:  <20101220160549.E888F20581@u18-124.dslaccess.de>
Resent-Message-ID: <201012201610.oBKGAAxA050171@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         153310
>Category:       ports
>Synopsis:       [patch] port net-mgmt/flowd register _flowd user in ports/UIDs/GIDs, add additional MASTER_SITE and more
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Mon Dec 20 16:10:10 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Olli Hauer <ohauer@FreeBSD.org>
>Release:        
>Organization:
>Environment:


>Description:
 - register _flowd user in ports/UIDs ports/GIDs
   use the registered ID's instead "pw usernext"
 - remove pkg-install and add a workaround for the user creation if installed from package
   (workaround for PR 152498)
 - add additional MASTER_SITE
 - add OPTIONS for PERL and PYTHON, with PERL on as default
   Additional fix leftovers if build with PERL is enabled [1]
  (I suspect PERL is installed on most every machine, and have a port in the pipe which need this module)
 - install tools to EXAMPLESDIR
 - remove MD5 from distinfo
 - fix pkg-plist "%%SITE_PERL%%/%%PERL_ARCH%%/auto" belongs to perl not to flowd [2]

[1]
snipped from tinderbuild if perl is enabled (befor fix)
...
Manifying blib/man3/Flowd.3
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
Installing /tmp/flowd/man/man3/Flowd.3
Appending installation info to /usr/local/lib/perl5/5.10.1/mach/perllocal.pod

...
=== Checking filesystem state
list of extra files and directories in / (not present before this port was installed but present after it was deinstalled)
 49046        4 -rw-r--r--    1 root             wheel                 226 Dec 20 14:01 usr/local/lib/perl5/5.10.1/mach/perllocal.pod
list of files present before this port was installed but missing after it was deinstalled)
./usr/local/lib/perl5/site_perl/5.10.1/mach/auto missing

[2]
# pkg_info -f perl-5.10.1_3 | grep site_perl | grep auto
        UNEXEC 'rmdir %D/lib/perl5/site_perl/5.10.1/mach/auto 2>/dev/null || true'
        UNEXEC 'rmdir %D/lib/perl5/site_perl/5.10.1/auto 2>/dev/null || true'


>How-To-Repeat:
>Fix:

--- patch_ports__uid_gid.txt begins here ---
Index: GIDs
===================================================================
RCS file: /home/pcvs/ports/GIDs,v
retrieving revision 1.118
diff -u -r1.118 GIDs
--- GIDs	14 Dec 2010 06:11:03 -0000	1.118
+++ GIDs	20 Dec 2010 14:36:37 -0000
@@ -130,6 +130,7 @@
 dkimproxy:*:525:
 pgbouncer:*:534:
 redis:*:535:
+_flowd:*:542:
 ejabberd:*:543:
 qtss:*:554:
 ircdru:*:555:
Index: UIDs
===================================================================
RCS file: /home/pcvs/ports/UIDs,v
retrieving revision 1.131
diff -u -r1.131 UIDs
--- UIDs	14 Dec 2010 06:11:03 -0000	1.131
+++ UIDs	20 Dec 2010 14:36:37 -0000
@@ -140,6 +140,7 @@
 dkimproxy:*:525:525::0:0:DKIM Proxy Owner:/nonexistent:/usr/sbin/nologin
 pgbouncer:*:534:534::0:0:Pgbouncer Daemon:/nonexistent:/usr/sbin/nologin
 redis:*:535:535::0:0:Redis Daemon:/nonexistent:/usr/sbin/nologin
+_flowd:*:542:542::0:0:flowd privilege separation user:/var/empty:/usr/sbin/nologin
 ejabberd:*:543:543::0:0:ejabberd pseudo user:/var/spool/ejabberd:/bin/sh
 qtss:*:554:554::0:0:Darwin Streaming Server:/nonexistent:/usr/sbin/nologin
 ircdru:*:555:555::0:0:Russian hybrid IRC server:/nonexistent:/bin/sh
--- patch_ports__uid_gid.txt ends here ---

--- patch_flowd.txt begins here ---
Index: Makefile
===================================================================
RCS file: /home/pcvs/ports/net-mgmt/flowd/Makefile,v
retrieving revision 1.15
diff -u -r1.15 Makefile
--- Makefile	15 Oct 2009 21:26:58 -0000	1.15
+++ Makefile	20 Dec 2010 14:38:18 -0000
@@ -9,11 +9,17 @@
 PORTVERSION=	0.9.1
 PORTREVISION=	1
 CATEGORIES=	net-mgmt ipv6
-MASTER_SITES=	http://www2.mindrot.org/files/flowd/
+MASTER_SITES=	${MASTER_SITE_GOOGLE_CODE} \
+		http://www2.mindrot.org/files/flowd/
 
 MAINTAINER=	janos.mohacsi@bsd.hu
 COMMENT=	The flowd is a small, fast and secure NetFlow collector
 
+OPTIONS=	PERL	"Install flowd perl module" on \
+		PYTHON	"Install flowd Python support" off
+
+.include <bsd.port.options.mk>
+
 GNU_CONFIGURE=	yes
 CONFIGURE_ARGS=	--localstatedir=/var
 USE_GMAKE=	yes
@@ -21,11 +27,9 @@
 MAN8=		flowd.8 flowd-reader.8
 MAN5=		flowd.conf.5
 PORTDOCS=	README INSTALL
-FLOWD_USER?=	_flowd
-SCRIPTS_ENV+=	FLOWD_USER="${FLOWD_USER}"
-.if defined(FLOWD_UID)
-SCRIPTS_ENV+=	FLOWD_UID="${FLOWD_UID}"
-.endif
+FLOWD_USER=	_flowd
+USERS=		${FLOWD_USER}
+GROUPS=		${FLOWD_USER}
 
 .if defined(WITH_PERL)
 USE_PERL5=	yes
@@ -60,8 +64,16 @@
 post-patch:
 	@${REINPLACE_CMD} -e "s;%%FLOWD_USER%%;${FLOWD_USER};g" \
 		${WRKSRC}/flowd.h
+	${REINPLACE_CMD} -i '' -e 's|/usr/bin/perl|${PERL}|' \
+		${WRKSRC}/tools/flowinsert.pl \
+		${WRKSRC}/tools/wormsuspects.pl
 
 post-install:
+# XXX Workaround: can be removed if the bug described in ports/152498 is fixed!
+	@${EGREP} -e '^@exec.*${PW}' -e '^@exec ${INSTALL} -d -g' ${TMPPLIST} > ${WRKDIR}/.PLIST.ugid
+	@${EGREP} -v -e '^@exec.*${PW}' -e '^@exec ${INSTALL} -d -g' ${TMPPLIST} >> ${WRKDIR}/.PLIST.ugid
+	@${MV} -v ${WRKDIR}/.PLIST.ugid ${TMPPLIST}
+
 .if !defined(NOPORTDOCS)
 	${MKDIR} ${DOCSDIR}
 	cd ${WRKSRC} && ${INSTALL_DATA} ${PORTDOCS} ${DOCSDIR}
@@ -69,10 +81,10 @@
 
 .if defined(WITH_PERL)
 	cd ${WRKSRC}/Flowd-perl && \
-	${PERL} Makefile.PL INSTALLSITEMAN3DIR=${MAN3PREFIX}/man/man3 && \
+	${PERL} Makefile.PL INSTALLSITEMAN3DIR=${MAN3PREFIX}/man/man3 PREFIX=${PREFIX} && \
 	${GMAKE} && \
 	${GMAKE} install;
-	-@${RM} -f ${SITE_PERL}/${PERL_ARCH}/perllocal.pod
+	-@${RM} -f ${PREFIX}/lib/perl5/${PERL_VERSION}/${PERL_ARCH}/perllocal.pod
 .endif
 
 .if defined(WITH_PYTHON)
@@ -81,6 +93,9 @@
 	${PYTHON_CMD} setup.py install
 .endif
 
-	@${SETENV} ${SCRIPTS_ENV} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
+.if !defined(NOPORTEXAMPLES)
+	${MKDIR} ${EXAMPLESDIR}
+	@( cd ${WRKSRC}/tools && ${COPYTREE_SHARE} \* ${EXAMPLESDIR}/ )
+.endif
 
 .include <bsd.port.mk>
Index: distinfo
===================================================================
RCS file: /home/pcvs/ports/net-mgmt/flowd/distinfo,v
retrieving revision 1.6
diff -u -r1.6 distinfo
--- distinfo	31 May 2009 18:42:14 -0000	1.6
+++ distinfo	20 Dec 2010 14:38:18 -0000
@@ -1,3 +1,2 @@
-MD5 (flowd-0.9.1.tar.gz) = a3d0512b5e6d9c7d9e749d9894376ea4
 SHA256 (flowd-0.9.1.tar.gz) = 3ce5e0bbf93b69b5de16b9ea644b38b8591948aadabfbbd6165a7ae505ccc10c
 SIZE (flowd-0.9.1.tar.gz) = 187483
Index: pkg-install
===================================================================
RCS file: pkg-install
diff -N pkg-install
--- pkg-install	15 Oct 2009 21:26:58 -0000	1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,48 +0,0 @@
-#!/bin/sh
-#
-#	$FreeBSD: ports/net-mgmt/flowd/pkg-install,v 1.3 2009/10/15 21:26:58 wxs Exp $
-#
-# Based on cyrus-sasl2 port
-#
-# create 'flowd' user 
-#
-
-create_user() {
-	USER=${FLOWD_USER}
-	GROUP=nobody
-	PW=/usr/sbin/pw
-
-	if [ -x /usr/sbin/nologin ]; then
-		shell=/usr/sbin/nologin
-	elif [ -x /sbin/nologin ]; then
-		shell=/sbin/nologin
-	else
-		shell=/nonexistent
-	fi
-	uhome="/var/empty"
-	if [ -z "${FLOWD_UID}" ]; then
-		uid=`${PW} usernext`;
-		uid=${uid%%:*}
-	else
-		uid=${FLOWD_UID}
-	fi
-
-	if ! ${PW} show user ${USER} -q >/dev/null; then
-		if ! ${PW} add user ${USER} -u ${uid} -g ${GROUP} -d "${uhome}" \
-				-c "flowd privilege separation user" -s "${shell}" -p "*" \
-				; then
-			e=$?
-			echo "*** Failed to add user \`${USER}'. Please add it manually."
-			exit ${e}
-		fi
-		echo "*** Added user \`${USER}' (id ${uid})"
-	else
-		echo "*** You already have user \`${USER} (id `id -u ${USER}`)'."
-	fi
-}
-
-case $2 in
-	POST-INSTALL)
-		create_user
-		;;
-esac
Index: pkg-plist
===================================================================
RCS file: /home/pcvs/ports/net-mgmt/flowd/pkg-plist,v
retrieving revision 1.2
diff -u -r1.2 pkg-plist
--- pkg-plist	1 Apr 2006 23:18:06 -0000	1.2
+++ pkg-plist	20 Dec 2010 14:38:18 -0000
@@ -1,19 +1,31 @@
 bin/flowd-reader
 etc/flowd.conf.sample
-lib/libflowd.a
 include/flowd/addr.h
 include/flowd/crc32.h
-include/flowd/store.h
-include/flowd/store-v2.h
-include/flowd/flowd-pytypes.h
-include/flowd/flowd-config.h
 include/flowd/flowd-common.h
-sbin/flowd
-%%WITH_PERL%%%%SITE_PERL%%/%%PERL_ARCH%%/auto/Flowd/Flowd.so
-%%WITH_PERL%%%%SITE_PERL%%/%%PERL_ARCH%%/auto/Flowd/Flowd.bs
-%%WITH_PERL%%%%SITE_PERL%%/%%PERL_ARCH%%/auto/Flowd/.packlist
+include/flowd/flowd-config.h
+include/flowd/flowd-pytypes.h
+include/flowd/store-v2.h
+include/flowd/store.h
+lib/libflowd.a
 %%WITH_PERL%%%%SITE_PERL%%/%%PERL_ARCH%%/Flowd.pm
-%%WITH_PERL%%@dirrm %%SITE_PERL%%/%%PERL_ARCH%%/auto/Flowd
-%%WITH_PERL%%@dirrm %%SITE_PERL%%/%%PERL_ARCH%%/auto
+%%WITH_PERL%%%%SITE_PERL%%/%%PERL_ARCH%%/auto/Flowd/.packlist
+%%WITH_PERL%%%%SITE_PERL%%/%%PERL_ARCH%%/auto/Flowd/Flowd.bs
+%%WITH_PERL%%%%SITE_PERL%%/%%PERL_ARCH%%/auto/Flowd/Flowd.so
 %%WITH_PYTHON%%%%PYTHON_SITELIBDIR%%/flowd.so
+sbin/flowd
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/README.tools
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/flowinsert.pl
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/flowrrd/bytes.html
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/flowrrd/flow_rrd.py
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/flowrrd/flows.html
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/flowrrd/packets.html
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/flowrrd/plot.sh
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/flows.sql
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/sockclient.py
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/stats.py
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/wormsuspects.pl
+%%PORTEXAMPLES%%@dirrm %%EXAMPLESDIR%%/flowrrd
+%%PORTEXAMPLES%%@dirrm %%EXAMPLESDIR%%
+%%WITH_PERL%%@dirrm %%SITE_PERL%%/%%PERL_ARCH%%/auto/Flowd
 @dirrm include/flowd
--- patch_flowd.txt ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20101220160549.E888F20581>