From nobody@FreeBSD.org  Mon Jan  8 11:45:45 2007
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 4B92716A403
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  8 Jan 2007 11:45:45 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [69.147.83.33])
	by mx1.freebsd.org (Postfix) with ESMTP id 2F89813C45E
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  8 Jan 2007 11:45:45 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id l08Bji29005067
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 8 Jan 2007 11:45:44 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id l08BjiVB005066;
	Mon, 8 Jan 2007 11:45:44 GMT
	(envelope-from nobody)
Message-Id: <200701081145.l08BjiVB005066@www.freebsd.org>
Date: Mon, 8 Jan 2007 11:45:44 GMT
From: Dominic Fandrey<lon_kamikaze@gmx.de>
To: freebsd-gnats-submit@FreeBSD.org
Subject: security/vpnc suggest rc.d script
X-Send-Pr-Version: www-3.0

>Number:         107675
>Category:       ports
>Synopsis:       security/vpnc suggest rc.d script
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    gabor
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jan 08 11:50:12 GMT 2007
>Closed-Date:    Mon Feb 26 19:07:04 GMT 2007
>Last-Modified:  Mon Feb 26 19:07:04 GMT 2007
>Originator:     Dominic Fandrey
>Release:        Releng_6
>Organization:
private
>Environment:
FreeBSD mobileKamikaze.norad 6.2-PRERELEASE FreeBSD 6.2-PRERELEASE #0: Sat Jan  6 20:03:48 CET 2007     root@homeKamikaze.norad:/usr/obj/TPR40-6/i386/usr/src/sys/TPR40-6  i386
>Description:
Vpnc doesn't come with a proper rc.d script. I have one and I suggest it's merged into the port.
>How-To-Repeat:

>Fix:
#!/bin/sh
#
# Author:	kamikaze
# Contact:	LoN_Kamikaze@gmx.de
#
# If vpnc_conf is defined, it will be treated as a list of configuration files
# in vpnc_conf_dir. This managed mode is useful where vpnc tunnels have
# to be established through other vpnc tunnels.
#

# PROVIDE: vpnc
# REQUIRE: NETWORKING
# KEYWORD: FreeBSD shutdown

# Default settings - don't change this.
: ${vpnc_enable="NO"}
: ${vpnc_flags=""}
: ${vpnc_conf=""}
# These values are only used when vpnc_conf is set.
: ${vpnc_pid_dir="/var/run"}
: ${vpnc_conf_dir="/usr/local/etc"}
: ${vpnc_record="$vpnc_pid_dir/vpnc.record"}

. /etc/rc.subr

name="vpnc"
rcvar=`set_rcvar`

command="/usr/local/sbin/$name"

vpnc_start() {
	if [ "$vpnc_conf" ]; then
		# Wait for the system to catch up. It's necessary to wait
		# a bit, if for example the device to tunnel through has
		# just been brought up.
		/bin/sleep 1

		# Make vpnc use random ports to allow multiple instances.
		vpnc_flags="$vpnc_flags --local-port 0"

		# A list of configurations is present. Connect managing
		# what is required for a clean shutdown later.
		for config in $vpnc_conf; {
			# The current configuration file.
			current="$vpnc_conf_dir/$config"
			# Start vpnc.
			$command $vpnc_flags $current

			# Give up on errors.
			status=$?
			if [ $status -ne 0 ]; then
				echo
				echo "Running 'vpnc $vpnc_flags $current' returned $status."
				return $status
			fi

			# Move files to allow a clean shutdown
			# of multiple connections.
			/bin/mv "$vpnc_pid_dir/vpnc.pid" "$vpnc_pid_dir/vpnc.$config.pid"
			/bin/mv "$vpnc_pid_dir/vpnc.defaultroute" "$vpnc_pid_dir/vpnc.$config.defaultroute" 2> /dev/null
			/bin/mv "$vpnc_pid_dir/vpnc.resolv.conf-backup" "$vpnc_pid_dir/vpnc.$config.resolv.conf-backup" 2> /dev/null
			echo "$config" >> "$vpnc_record"

			# Wait for the system to catch up.
			/bin/sleep 1
		}
	else
		# No configuration files given, run unmanaged.
		$command $vpnc_flags
		return $?
	fi
}

vpnc_stop() {
	if [ -e "$vpnc_record" ]; then
		# A record of vpnc connections is present. Attempt a
		# managed shutdown.
		for config in `/usr/bin/tail -r "$vpnc_record"`; {
			# Wait to give the system a chance to catch up with
			# recent changes.
			/bin/sleep 1

			# Move the vpnc files back into position.
			/bin/mv "$vpnc_pid_dir/vpnc.$config.pid" "$vpnc_pid_dir/vpnc.pid"
			/bin/mv "$vpnc_pid_dir/vpnc.$config.defaultroute" "$vpnc_pid_dir/vpnc.defaultroute" 2> /dev/null
			/bin/mv "$vpnc_pid_dir/vpnc.$config.resolv.conf-backup" "$vpnc_pid_dir/vpnc.resolv.conf-backup" 2> /dev/null

			# Run the disconnect command.
			$command-disconnect
		}
		# Remove the connection record.
		/bin/rm "$vpnc_record"
	else
		/bin/sleep 1
		# There's no record of connections, asume unmanaged shutdown.
		$command-disconnect
		return $?
	fi
}

start_cmd=vpnc_start
stop_cmd=vpnc_stop

load_rc_config $name
run_rc_command "$1"
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: edwin 
State-Changed-When: Mon Jan 8 11:50:23 UTC 2007 
State-Changed-Why:  
Awaiting maintainers feedback 

http://www.freebsd.org/cgi/query-pr.cgi?pr=107675 

From: Christian Lackas <delta@lackas.net>
To: bug-followup@FreeBSD.ORG
Cc: "[LoN]Kamikaze" <LoN_Kamikaze@gmx.de>, Edwin Groothuis <edwin@FreeBSD.ORG>
Subject: Re: ports/107675: security/vpnc suggest rc.d script
Date: Tue, 23 Jan 2007 18:36:55 +0100

 Hi Everyone,
 
 thanks for the submission, the new start script looks good and works
 fine. Please find attached a patch with a PREFIX-aware version of the
 script as well as the required changes to the Makefile.
 Please remove the old file in files/vpnc.sh.
 
 
 Best regards,
  Christian (Maintainer)
 
 
 
 
 diff -Nur /usr/ports/security/vpnc/Makefile vpnc/Makefile
 --- /usr/ports/security/vpnc/Makefile	Sat Jul 29 22:41:30 2006
 +++ vpnc/Makefile	Tue Jan 23 18:34:22 2007
 @@ -7,7 +7,7 @@
  
  PORTNAME=	vpnc
  PORTVERSION=	0.3.3
 -PORTREVISION=	3
 +PORTREVISION=	4
  CATEGORIES=	security
  MASTER_SITES=	http://www.unix-ag.uni-kl.de/~massar/vpnc/
  
 @@ -23,7 +23,7 @@
  		sbin/vpnc-script \
  		sbin/vpnc-disconnect \
  		etc/vpnc.conf.sample \
 -		etc/rc.d/vpnc.sh.sample
 +		etc/rc.d/vpnc
  
  PORTDOCS=	README ChangeLog TODO
  MAN8=		vpnc.8
 @@ -41,9 +41,9 @@
  	@${INSTALL_PROGRAM} -m 751 ${WRKSRC}/vpnc ${PREFIX}/sbin/vpnc
  	@${INSTALL_SCRIPT} -m 751 ${WRKSRC}/vpnc-script ${PREFIX}/sbin/vpnc-script
  	@${INSTALL_SCRIPT} -m 751 ${WRKSRC}/vpnc-disconnect ${PREFIX}/sbin/vpnc-disconnect
 -	@${INSTALL_SCRIPT} ${FILESDIR}/vpnc.sh ${WRKDIR}
 -	@${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|' ${WRKDIR}/vpnc.sh
 -	@${INSTALL_SCRIPT} -m 755 ${WRKDIR}/vpnc.sh ${PREFIX}/etc/rc.d/vpnc.sh.sample
 +	@${INSTALL_SCRIPT} ${FILESDIR}/vpnc ${WRKDIR}
 +	@${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|' ${WRKDIR}/vpnc
 +	@${INSTALL_SCRIPT} -m 755 ${WRKDIR}/vpnc ${PREFIX}/etc/rc.d/vpnc
  	@${INSTALL_DATA} -m 600 ${WRKSRC}/vpnc.conf ${PREFIX}/etc/vpnc.conf.sample
  .if !defined(NO_INSTALL_MANPAGES)
  	@${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|' ${WRKSRC}/vpnc.8
 diff -Nur /usr/ports/security/vpnc/files/vpnc vpnc/files/vpnc
 --- /usr/ports/security/vpnc/files/vpnc	Thu Jan  1 01:00:00 1970
 +++ vpnc/files/vpnc	Tue Jan 23 18:28:48 2007
 @@ -0,0 +1,95 @@
 +#!/bin/sh
 +#
 +# Author:	kamikaze
 +# Contact:	LoN_Kamikaze@gmx.de
 +#
 +# If vpnc_conf is defined, it will be treated as a list of configuration files
 +# in vpnc_conf_dir. This managed mode is useful where where vpnc tunnels have
 +# to be established through other vpnc tunnels.
 +#
 +
 +# PROVIDE: vpnc
 +# REQUIRE: NETWORKING
 +# KEYWORD: FreeBSD shutdown
 +
 +# Default settings - don't change this.
 +: ${vpnc_enable="NO"}
 +: ${vpnc_conf=""}
 +: ${vpnc_pid_dir="/var/run"}
 +: ${vpnc_conf_dir="%%PREFIX%%/etc"}
 +: ${vpnc_flags=""}
 +: ${vpnc_record="$vpnc_pid_dir/vpnc.record"}
 +
 +. /etc/rc.subr
 +
 +name="vpnc"
 +rcvar=`set_rcvar`
 +
 +command="%%PREFIX%%/sbin/$name"
 +
 +vpnc_start() {
 +	if [ "$vpnc_conf" ]; then
 +		# A list of configurations is present. Connect managing
 +		# what is required for a clean shutdown later.
 +		for config in $vpnc_conf; {
 +			# The current configuration file.
 +			current="$vpnc_conf_dir/$config"
 +			# Start vpnc.
 +			$command $current $vpnc_flags
 +
 +			# Give up on errors.
 +			status=$?
 +			if [ $status -ne 0 ]; then
 +				echo "Running 'vpnc $current $vpnc_flags' failed."
 +				return $status
 +			fi
 +
 +			# Move files to allow a clean shutdown
 +			# of multiple connections.
 +			/bin/mv "$vpnc_pid_dir/vpnc.pid" "$vpnc_pid_dir/vpnc.$config.pid"
 +			/bin/mv "$vpnc_pid_dir/vpnc.defaultroute" "$vpnc_pid_dir/vpnc.$config.defaultroute" 2> /dev/null
 +			/bin/mv "$vpnc_pid_dir/vpnc.resolv.conf-backup" "$vpnc_pid_dir/vpnc.$config.resolv.conf-backup" 2> /dev/null
 +			echo "$config" >> "$vpnc_record"
 +
 +			# Wait for the system to catch up.
 +			/bin/sleep 1
 +		}
 +	else
 +		# No configuration files given, run unmanaged.
 +		$command $vpnc_flags
 +		return $?
 +	fi
 +}
 +
 +vpnc_stop() {
 +	if [ -e "$vpnc_record" ]; then
 +		# A record of vpnc connections is present. Attempt a
 +		# managed shutdown.
 +		for config in `/usr/bin/tail -r "$vpnc_record"`; {
 +			# Wait to give the system a chance to catch up with
 +			# recent changes.
 +			/bin/sleep 1
 +
 +			# Move the vpnc files back into position.
 +			/bin/mv "$vpnc_pid_dir/vpnc.$config.pid" "$vpnc_pid_dir/vpnc.pid"
 +			/bin/mv "$vpnc_pid_dir/vpnc.$config.defaultroute" "$vpnc_pid_dir/vpnc.defaultroute" 2> /dev/null
 +			/bin/mv "$vpnc_pid_dir/vpnc.$config.resolv.conf-backup" "$vpnc_pid_dir/vpnc.resolv.conf-backup" 2> /dev/null
 +
 +			# Run the disconnect command.
 +			$command-disconnect
 +		}
 +		# Remove the connection record.
 +		/bin/rm "$vpnc_record"
 +	else
 +		/bin/sleep 1
 +		# There's no record of connections, asume unmanaged shutdown.
 +		$command-disconnect
 +		return $?
 +	fi
 +}
 +
 +start_cmd=vpnc_start
 +stop_cmd=vpnc_stop
 +
 +load_rc_config $name
 +run_rc_command "$1"
 
 
 
 
 
 
 
 -- 
 http://www.lackas.net/ Perl Delphi Linux MP3 Searchengines Domainchecker
 http://www.spect-ct.com/
State-Changed-From-To: feedback->open 
State-Changed-By: gabor 
State-Changed-When: Mon Feb 19 12:04:59 UTC 2007 
State-Changed-Why:  
Maintainer approved. 


Responsible-Changed-From-To: freebsd-ports-bugs->gabor 
Responsible-Changed-By: gabor 
Responsible-Changed-When: Mon Feb 19 12:04:59 UTC 2007 
Responsible-Changed-Why:  
Take. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=107675 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/107675: commit references a PR
Date: Mon, 26 Feb 2007 18:57:47 +0000 (UTC)

 gabor       2007-02-26 18:57:31 UTC
 
   FreeBSD ports repository
 
   Modified files:
     security/vpnc        Makefile 
   Added files:
     security/vpnc/files  vpnc.in 
   Removed files:
     security/vpnc/files  vpnc.sh 
   Log:
   - Update rc.d script
   - Use USE_RC_SUBR instead of direct patching
   - Bump PORTREVISION
   
   PR:             ports/107675
   Submitted by:   Dominic Fandrey <lon_kamikaze@gmx.de> (with fixes from maintainer)
   Approved by:    Christian Lackas <delta@lackas.net> (maintainer),
                   erwin (mentor, implicit)
   
   Revision  Changes    Path
   1.21      +4 -6      ports/security/vpnc/Makefile
   1.1       +95 -0     ports/security/vpnc/files/vpnc.in (new)
   1.4       +0 -29     ports/security/vpnc/files/vpnc.sh (dead)
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->closed 
State-Changed-By: gabor 
State-Changed-When: Mon Feb 26 19:06:04 UTC 2007 
State-Changed-Why:  
Committed with minor modification, thanks! For reinplace-editing 
the rc.d file the USE_RC_SUBR macro should be used. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=107675 
>Unformatted:
