ports/104514: [update port] net/bounce: provide rc_subr script

Alexander Logvinov ports at logvinov.com
Wed Oct 18 04:40:18 UTC 2006


>Number:         104514
>Category:       ports
>Synopsis:       [update port] net/bounce: provide rc_subr script
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Oct 18 04:40:17 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Alexander Logvinov
>Release:        FreeBSD 6.1-RELEASE-p3 i386
>Organization:
>Environment:

>Description:

 Provide rc_subr script for bounce

>How-To-Repeat:

>Fix:

diff -ruN --exclude=CVS /usr/ports/net/bounce/Makefile /home/user/bounce/Makefile
--- /usr/ports/net/bounce/Makefile	Fri Jul 28 13:09:26 2006
+++ /home/user/bounce/Makefile	Wed Oct 18 14:23:45 2006
@@ -8,7 +8,7 @@
 
 PORTNAME=	bounce
 PORTVERSION=	1.0
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	net security
 MASTER_SITES=	http://www.iagora.com/~espel/ \
 		${MASTER_SITE_LOCAL}
@@ -19,11 +19,12 @@
 MAINTAINER=	matt at efs.org
 COMMENT=	Bounce tcp connections to another machine/port
 
-NO_WRKSUBDIR=	yes
+USE_RC_SUBR=	bounce
+WRKSRC=		${WRKDIR}/${PORTNAME}-${PORTVERSION}
 
 do-extract:
-	@${MKDIR} ${WRKDIR}
-	@${CP} ${DISTDIR}/${DISTFILES} ${WRKDIR}
+	@${MKDIR} ${WRKSRC}
+	@${CP} ${DISTDIR}/${DISTFILES} ${WRKSRC}
 
 do-build:
 	(cd ${WRKSRC} && ${CC} ${CFLAGS} -o ${DISTNAME} ${DISTNAME}.c)
diff -ruN --exclude=CVS /usr/ports/net/bounce/files/bounce.in /home/user/bounce/files/bounce.in
--- /usr/ports/net/bounce/files/bounce.in	Thu Jan  1 09:00:00 1970
+++ /home/user/bounce/files/bounce.in	Wed Oct 18 14:12:50 2006
@@ -0,0 +1,53 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+#
+# PROVIDE: bounce
+# REQUIRE: NETWORKING
+#
+# Add the following line to /etc/rc.conf to enable bounce
+#
+# bounce_enable (bool):			Set to "NO" by default.
+#					Set it to "YES" to enable bounce.
+# bounce_connections (str):		Name for each bounce connection.
+# bounce_connectionname_options (str):	Commandline for each bounce connection.
+#
+
+. %%RC_SUBR%%
+
+name="bounce"
+rcvar=${name}_enable
+
+load_rc_config $name
+
+: ${bounce_enable="NO"}
+
+command="/usr/local/sbin/${name}"
+start_cmd="bounce_startcmd"
+
+bounce_startcmd()
+{
+    if [ -z "$rc_fast" -a -n "$rc_pid" ]; then
+	echo "${name} already running? (pid=$rc_pid)."
+	return 1
+    fi
+    if [ -z "${bounce_connections}" ]; then
+	err 1 "can't find bounce_connections in /etc/rc.conf"
+    fi	
+    echo Starting ${name}.
+    for connection in ${bounce_connections}; do
+	eval options=\$bounce_${connection}_options
+	if [ -z "${options}" ]; then
+	    continue
+	fi
+	command_args="${options}"
+	cmd="${command} ${command_args}"
+	if [ -n "$bounce_user" ]; then
+	    cmd="su -m $bounce_user -c '$cmd'"
+	fi
+	eval "$cmd"
+	done
+}
+
+run_rc_command "$1"
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list