Index: head/net/socat/Makefile =================================================================== --- head/net/socat/Makefile (revision 313619) +++ head/net/socat/Makefile (revision 313620) @@ -1,50 +1,50 @@ # Created by: ijliao # $FreeBSD$ PORTNAME= socat PORTVERSION= 1.7.2.1 +PORTREVISION= 1 CATEGORIES= net ipv6 MASTER_SITES= http://www.dest-unreach.org/socat/download/ \ CRITICAL MAINTAINER= ehaupt@FreeBSD.org COMMENT= Multipurpose relay and more LICENSE= GPLv2 GNU_CONFIGURE= yes USE_BZIP2= yes USE_RC_SUBR= socat USE_OPENSSL= yes MAKE_JOBS_SAFE= yes PORTSCOUT= skipv:2.0.0-b2 MAN1= socat.1 -PLIST_FILES= bin/filan bin/procan bin/socat sbin/socat_wrapper +PLIST_FILES= bin/filan bin/procan bin/socat PORTDOCS= EXAMPLES README SECURITY FAQ .if ${CC} == clang CFLAGS+= -Wno-unused-comparison .endif OPTIONS_DEFINE= DOCS .include do-install: .for f in filan procan socat ${INSTALL_PROGRAM} ${WRKSRC}/${f} ${PREFIX}/bin .endfor - ${INSTALL_SCRIPT} ${FILESDIR}/socat_wrapper ${PREFIX}/sbin ${INSTALL_MAN} ${WRKSRC}/doc/${MAN1} ${MAN1PREFIX}/man/man1 .if ${PORT_OPTIONS:MDOCS} ${MKDIR} ${DOCSDIR} cd ${WRKSRC} && ${INSTALL_DATA} ${PORTDOCS} ${DOCSDIR} .endif .if ${ARCH} == "arm" BROKEN= Does not configure on arm .endif .include Index: head/net/socat/files/socat_wrapper =================================================================== --- head/net/socat/files/socat_wrapper (revision 313619) +++ head/net/socat/files/socat_wrapper (nonexistent) @@ -1,91 +0,0 @@ -#!/bin/sh -T -# -#- -# Copyright 2009 Thomas-Martin Seck. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted providing that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# $FreeBSD$ -# -# socat_wrapper socat [options] -# -# A simple wrapper script for socat (or any other program that does not -# daemonize itself and logs to stdout). -# -# This wrapper tries to emulate part of the functionality usually supplied by -# software like daemontools or runit. It can be used by a FreeBSD port rc.d -# script to start a program that does not daemonize itself and logs to -# stdout/stderr. It redirects stdout and stderr to logger(1) via a fifo. -# -# Note: We need a shell that can offer us asynchronous trap handling in order -# to be able to abort the infinite loop from outside. FreeBSD's /bin/sh offers -# the "-T" switch for this purpose. -# -# TODO: send fd 2 output to never-never land to get rid of "Terminated" when we -# kill this script but provide a way for errx() to communicate with the outside -# world via stderr. -# - -errx() { - echo "${me}: $@" >&2 - exit 1 -} - -cleanup() { - rm -rf ${tmpdir} - rm -f ${pidfile} -} - -PATH=/bin:/sbin:/usr/bin:/usr/sbin - -me=${0##*/} -logger=/usr/bin/logger -daemon_log_facility=daemon.notice -self_log_facility=daemon.notice -pidfile=/var/run/${me}.pid -daemon_name=socat -daemon_program="$1" -shift - -test -x "${daemon_program}" || errx "cannot execute ${daemon_program}!" -test -x ${logger} || errx "cannot execute ${logger}!" -test -f ${pidfile} && errx "${pidfile} is already present -- is another instance of ${me} running?" -echo $$ >${pidfile} || errx "cannot write to ${pidfile}!" -tmpdir=`mktemp -d /tmp/${me}.XXXXXXXXXX` || errx "cannot generate tmpdir!" - -logfifo=${tmpdir}/fifo -mkfifo -m 0600 ${logfifo} || errx "cannot generate fifo!" - -while true; do - trap 'break' 1 2 3 6 9 15 - ${logger} -i -p ${daemon_log_facility} -t ${daemon_name} <${logfifo} & - log_pid=$! - "${daemon_program}" $@ >${logfifo} 2>&1 & - daemon_pid=$! - wait ${daemon_pid} - ${logger} -i -p ${self_log_facility} -t ${me} "${daemon_program} died -- restarting..." - sleep 2 -done - -kill -TERM ${daemon_pid} 2>/dev/null -wait -cleanup Property changes on: head/net/socat/files/socat_wrapper ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/net/socat/files/socat.in =================================================================== --- head/net/socat/files/socat.in (revision 313619) +++ head/net/socat/files/socat.in (revision 313620) @@ -1,30 +1,34 @@ #!/bin/sh # # Author: Emanuel Haupt # # $FreeBSD$ # # PROVIDE: socat # REQUIRE: LOGIN # KEYWORD: shutdown # Add the following lines to /etc/rc.conf to enable socat: # socat_enable="YES" # socat_flags="" . /etc/rc.subr name="socat" rcvar=socat_enable load_rc_config $name : ${socat_enable="NO"} -socat_flags="%%PREFIX%%/bin/socat ${socat_flags} &" -command="%%PREFIX%%/sbin/socat_wrapper" -command_interpreter="/bin/sh -T" -pidfile=/var/run/socat_wrapper.pid +start_cmd="${name}_start" +pidfile=/var/run/socat.pid +command="%%PREFIX%%/bin/socat" + +socat_start() { + echo "Starting ${name}." + /usr/sbin/daemon -f -p ${pidfile} ${command} ${socat_flags} +} run_rc_command "$1"