ports/143179: [PATCH] net-mgmt/mrtg: use $USERS & $GROUPS to handle users instead of via pkg-install

Sevan Janiyan venture37 at geeklan.co.uk
Sun Jan 24 18:20:02 UTC 2010


>Number:         143179
>Category:       ports
>Synopsis:       [PATCH] net-mgmt/mrtg: use $USERS & $GROUPS to handle users instead of via pkg-install
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jan 24 18:20:01 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Sevan Janiyan
>Release:        FreeBSD 8.0-RELEASE-p2 amd64
>Organization:
>Environment:
System: FreeBSD newbie.thingamajig-systems.co.uk 8.0-RELEASE-p2 FreeBSD 8.0-RELEASE-p2 #0: Tue Jan  5 21:11:58 UTC
>Description:
remove /var/run/mrtg via pkg-deinstall instead of via plist
pkg-install is already listed in SUB_FILES, no need to invoke sed manually

Added file(s):
- files/pkg-deinstall.in

Port maintainer (ports at subnets.ru) is cc'd.

Generated with FreeBSD Port Tools 0.99
>How-To-Repeat:
>Fix:

--- mrtg-2.16.2_3,1.patch begins here ---
Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/net-mgmt/mrtg/Makefile,v
retrieving revision 1.102
diff -u -r1.102 Makefile
--- Makefile	24 Jan 2010 06:18:06 -0000	1.102
+++ Makefile	24 Jan 2010 18:12:22 -0000
@@ -24,22 +24,21 @@
 CONFIGURE_ARGS=	--with-gd-lib=${LOCALBASE}/lib \
 		--with-gd-inc=${LOCALBASE}/include
 
+USERS=		mrtg
+GROUPS=		mrtg
+
 USE_PERL5=	YES
 MAKE_ENV+=	PERL=${PERL}
-MRTG_USER?=	mrtg
-MRTG_GROUP?=	mrtg
-MRTG_UID?=	279
-MRTG_GID?=	279
 MRTG_RUNDIR?=	/var/run/mrtg
 
 USE_RC_SUBR=	mrtg_daemon
-SUB_FILES=	pkg-install pkg-message
+SUB_FILES=	pkg-deinstall pkg-install pkg-message
 SUB_LIST=	PERL=${PERL} \
-		MRTG_USER=${MRTG_USER} \
-		MRTG_GROUP=${MRTG_GROUP} \
-		MRTG_UID=${MRTG_UID} \
-		MRTG_GID=${MRTG_GID} \
-		MRTG_RUNDIR=${MRTG_RUNDIR}
+		MRTG_RUNDIR=${MRTG_RUNDIR} \
+		USERS=${USERS} \
+		GROUPS=${GROUPS}
+PKGINSTALL=	${WRKDIR}/pkg-install
+PKGDEINSTALL=	${WRKDIR}/pkg-deinstall
 
 GNU_CONFIGURE=	YES
 CONFIGURE_ENV=	PERL=${PERL}
@@ -68,7 +67,7 @@
 OPTIONS=	IPV6 "Enable IPv6 support" OFF \
 		SNMP "Enable use of SNMPv3" OFF
 
-.include <bsd.port.pre.mk>
+.include <bsd.port.options.mk>
 
 .if defined(WITH_IPV6)
 RUN_DEPENDS+=	${SITE_PERL}/IO/Socket/INET6.pm:${PORTSDIR}/net/p5-IO-INET6
@@ -77,23 +76,17 @@
 RUN_DEPENDS+=	${SITE_PERL}/Net/SNMP.pm:${PORTSDIR}/net-mgmt/p5-Net-SNMP
 .endif
 
+.include <bsd.port.pre.mk>
+
 post-patch:
 	@${RM} ${WRKSRC}/lib/mrtg2/BER.pm ${WRKSRC}/lib/mrtg2/SNMP_*.pm
 
-pre-configure:
-	@${SED} -e 's,%%MRTG_USER%%,${MRTG_USER},g;' \
-		-e 's,%%MRTG_GROUP%%,${MRTG_GROUP},g;' \
-		-e 's,%%MRTG_UID%%,${MRTG_UID},g;' \
-		-e 's,%%MRTG_GID%%,${MRTG_GID},g;' \
-		-e 's,%%MRTG_RUNDIR%%,${MRTG_RUNDIR},g;' \
-		< ${FILESDIR}/pkg-install.in > ${PKGINSTALL}
-	@${SETENV} @PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} \
-		PRE-INSTALL
-
 do-install:
 .if !defined(NOPORTDOCS)
 	@${MKDIR} ${DOCSDIR}
 	@${INSTALL_DATA} ${DOCS:S,^,${WRKSRC}/,} ${DOCSDIR}/
+.endif
+.if !defined(NOPORTEXAMPLES)
 	@${MKDIR} ${EXAMPLESDIR}/doc ${EXAMPLESDIR}/images
 	@${INSTALL_DATA} ${EXAMPLES:S,^,${WRKSRC}/doc/,} ${EXAMPLESDIR}/doc/
 	@${INSTALL_DATA} ${IMAGES:S,^,${WRKSRC}/images/,} ${EXAMPLESDIR}/images/
Index: pkg-plist
===================================================================
RCS file: /home/ncvs/ports/net-mgmt/mrtg/pkg-plist,v
retrieving revision 1.26
diff -u -r1.26 pkg-plist
--- pkg-plist	10 Jan 2010 15:09:14 -0000	1.26
+++ pkg-plist	24 Jan 2010 18:12:22 -0000
@@ -61,7 +61,6 @@
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/images/mrtg-r.png
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/images/mrtg-ti.gif
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/images/mrtg-ti.png
- at dirrmtry /var/run/mrtg
 @dirrmtry %%ETCDIR%%
 %%PORTDOCS%%@dirrm %%DOCSDIR%%
 %%PORTEXAMPLES%%@dirrm %%EXAMPLESDIR%%/images
Index: files/pkg-deinstall.in
===================================================================
RCS file: files/pkg-deinstall.in
diff -N files/pkg-deinstall.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/pkg-deinstall.in	24 Jan 2010 18:12:22 -0000
@@ -0,0 +1,2 @@
+#!/bin/sh
+rm -rf %%MRTG_RUNDIR%% 
Index: files/pkg-install.in
===================================================================
RCS file: /home/ncvs/ports/net-mgmt/mrtg/files/pkg-install.in,v
retrieving revision 1.1
diff -u -r1.1 pkg-install.in
--- files/pkg-install.in	24 May 2008 02:31:24 -0000	1.1
+++ files/pkg-install.in	24 Jan 2010 18:12:22 -0000
@@ -8,27 +8,16 @@
 MKDIR="/bin/mkdir -p"
 NOLOGIN="/usr/sbin/nologin"
 
-MRTG_USER=%%MRTG_USER%%
-MRTG_GROUP=%%MRTG_GROUP%%
-MRTG_UID=%%MRTG_UID%%
-MRTG_GID=%%MRTG_GID%%
 MRTG_RUNDIR=%%MRTG_RUNDIR%%
 
 case "$2" in
-	
-PRE-INSTALL)
-  ${PW} groupshow -n ${MRTG_GROUP} >/dev/null 2>&1 \
-    || ${PW} groupadd -n ${MRTG_GROUP} -g ${MRTG_GID}
-  ${PW} usershow -n ${MRTG_USER} >/dev/null 2>&1 \
-    || ${PW} useradd ${MRTG_USER} -g ${MRTG_GROUP} -u ${MRTG_UID} -s ${NOLOGIN}
-  ;;
 
 POST-INSTALL)
 	if [ ! -d "$MRTG_RUNDIR" ]; then
 		${MKDIR} $MRTG_RUNDIR
 	fi
 
-	${CHOWN} -R ${MRTG_USER}:${MRTG_USER} ${MRTG_RUNDIR}
+	${CHOWN} -R %%USERS%%:%%GROUPS%% ${MRTG_RUNDIR}
 	${CHMOD} 0700 ${MRTG_RUNDIR}
 	;;
 esac
--- mrtg-2.16.2_3,1.patch ends here ---

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list