ports/151819: [patch] net-p2p/uhub port improvements

Aragon Gouveia aragon at phat.za.net
Fri Oct 29 18:40:11 UTC 2010


>Number:         151819
>Category:       ports
>Synopsis:       [patch] net-p2p/uhub port improvements
>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:   Fri Oct 29 18:40:07 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Aragon Gouveia
>Release:        8.1-STABLE
>Organization:
>Environment:
FreeBSD igor.geek.sh 8.1-STABLE FreeBSD 8.1-STABLE #0: Sat Jul 24 19:06:08 SAST 2010     toor at igor.geek.sh:/usr/obj/usr/src/sys/IGOR  amd64
>Description:
Attached patch makes some improvements to the net-p2p/uhub port:

* Sets up a uhub UID and GID for the daemon to run as.
* Modifies configuration file permissions to restrict them to root and the above GID.
* Patches uhub source so that PREFIX/etc/uhub/uhub.conf is the compiled in default configuration file.
* rc.d script changes - enable above uid/gid, enable syslog logging, simplify.

I think these changes are an improvement.  Please consider committing them.

Thanks!

>How-To-Repeat:

>Fix:


Patch attached with submission follows:

--- net-p2p/uhub/Makefile.orig	2010-10-29 17:57:45.000000000 +0200
+++ net-p2p/uhub/Makefile	2010-10-29 20:24:54.000000000 +0200
@@ -7,7 +7,7 @@
 
 PORTNAME=	uhub
 PORTVERSION=	0.3.2
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	net-p2p
 MASTER_SITES=	http://www.extatic.org/downloads/uhub/
 DISTNAME=	${PORTNAME}-${PORTVERSION}-src
@@ -19,6 +19,10 @@
 USE_GMAKE=	yes
 
 USE_RC_SUBR=	uhub.sh
+USERS=		uhub
+GROUPS=		uhub
+SHAREGRP=	uhub
+SHAREMODE=	640
 
 WRKSRC=		${WRKDIR}/${PORTNAME}-${PORTVERSION}
 MAKEFILE=	${WRKSRC}/GNUmakefile
@@ -36,15 +40,18 @@
 
 post-patch:
 	@${REINPLACE_CMD} -e 's|/etc/uhub/|${PREFIX}&|' ${WRKSRC}/doc/uhub.conf
+	@${REINPLACE_CMD} -e 's|/etc/uhub/|${PREFIX}&|' ${WRKSRC}/src/uhub.h
 
-post-install:
+do-install:
+	@${INSTALL_PROGRAM} ${WRKSRC}/uhub ${PREFIX}/bin/uhub
+	@${MKDIR} ${PREFIX}/etc/uhub
 	@${INSTALL_DATA} ${WRKSRC}/doc/uhub.conf ${PREFIX}/etc/uhub/uhub.conf.sample
 	@${INSTALL_DATA} ${WRKSRC}/doc/users.conf ${PREFIX}/etc/uhub/users.conf.sample
-	@if [ -f ${PREFIX}/etc/uhub/motd.txt ]; then \
-		${TOUCH} ${PREFIX}/etc/uhub/motd.txt.sample ; \
-	fi
-	@if [ -f ${PREFIX}/etc/uhub/rules.txt ]; then \
-		${TOUCH} ${PREFIX}/etc/uhub/rules.txt.sample ; \
-	fi
+	@${INSTALL_DATA} /dev/null ${PREFIX}/etc/uhub/motd.txt.sample
+	@${INSTALL_DATA} /dev/null ${PREFIX}/etc/uhub/rules.txt.sample
+.for i in uhub.conf users.conf motd.txt rules.txt
+	@[ ! -f ${PREFIX}/etc/uhub/${i} ] \
+	&& cp -p ${PREFIX}/etc/uhub/${i}.sample ${PREFIX}/etc/uhub/${i}
+.endfor
 
 .include <bsd.port.post.mk>
--- net-p2p/uhub/files/uhub.sh.in.orig	2010-10-29 18:25:29.000000000 +0200
+++ net-p2p/uhub/files/uhub.sh.in	2010-10-29 20:18:27.000000000 +0200
@@ -11,8 +11,6 @@
 #
 # uhub_enable (bool):	Set it to "YES" to enable uhub
 #			Default is "NO".
-# uhub_conf (path):	Set full path to config file.
-#			Default is "%%PREFIX%%/etc/uhub/uhub.conf".
 # uhub_pidfile (path):	Set full path to pid file.
 #			Default is "/var/run/uhub.pid".
 #
@@ -24,12 +22,12 @@
 
 load_rc_config $name
 
-: ${uhub_enable="NO"}
-: ${uhub_conf="%%PREFIX%%/etc/uhub/uhub.conf"}
-: ${uhub_pidfile="/var/run/${name}.pid"}
+: ${uhub_enable:="NO"}
+: ${uhub_flags:="-L -u uhub -g uhub"}
+: ${uhub_pidfile:="/var/run/${name}.pid"}
 
 command=%%PREFIX%%/bin/uhub
-command_args="-fq -c ${uhub_conf} -p ${uhub_pidfile}"
+command_args="-f -p ${uhub_pidfile}"
 pidfile=${uhub_pidfile}
 required_files=${uhub_conf}
 stop_postcmd=stop_postcmd
--- UIDs.orig	2010-10-29 18:54:35.000000000 +0200
+++ UIDs	2010-10-29 18:55:29.000000000 +0200
@@ -128,6 +128,7 @@
 httptunnel:*:361:361::0:0:httptunnel Daemon:/nonexistent:/usr/sbin/nologin
 ldap:*:389:389::0:0:OpenLDAP Server:/nonexistent:/usr/sbin/nologin
 tiarra:*:398:398::0:0:Tiarra IRC Proxy:/nonexistent:/usr/sbin/nologin
+uhub:*:411:411::0:0:uHub ADC Daemon:/nonexistent:/usr/sbin/nologin
 drweb:*:426:426::0:0:Dr.Web Mail Scanner:/nonexistent:/usr/sbin/nologin
 callweaver:*:444:444::0:0:Callweaver account:/var/lib/callweaver:/usr/sbin/nologin
 courier:*:465:465::0:0:Courier Mail Server:/nonexistent:/usr/sbin/nologin
--- GIDs.orig	2010-10-29 18:54:39.000000000 +0200
+++ GIDs	2010-10-29 18:55:48.000000000 +0200
@@ -118,6 +118,7 @@
 httptunnel:*:361:
 ldap:*:389:
 tiarra:*:398:
+uhub:*:411:
 drweb:*:426:
 callweaver:*:444:
 courier:*:465:


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



More information about the freebsd-ports-bugs mailing list