diff options
author | dougb <dougb@FreeBSD.org> | 2011-08-10 05:31:06 +0800 |
---|---|---|
committer | dougb <dougb@FreeBSD.org> | 2011-08-10 05:31:06 +0800 |
commit | 3b7e15f3b0af8444cab2ad9531767a54d37ee98f (patch) | |
tree | 5cf04eb7c9ec15050b5686d33d91890f6b67290a | |
parent | c825251e18a30f7d442fc8ba4c01b00445477352 (diff) | |
download | freebsd-ports-gnome-3b7e15f3b0af8444cab2ad9531767a54d37ee98f.tar.gz freebsd-ports-gnome-3b7e15f3b0af8444cab2ad9531767a54d37ee98f.tar.zst freebsd-ports-gnome-3b7e15f3b0af8444cab2ad9531767a54d37ee98f.zip |
1. Convert to proper rc.d scripts for mediaproxy and proxydispatcher
2. Maintains the mediaproxy script as the "master," so the user
experience of 'service mediaproxy <start|stop>' will be the same.
3. Instead of resetting ${WRKSRC}, mv the directory to the more typical
name so that we can use mediaproxy.in instead of mediaproxy.sh.in.
PR: ports/157073
Submitted by: me
Approved by: maintainer
-rw-r--r-- | net/mediaproxy/Makefile | 11 | ||||
-rw-r--r-- | net/mediaproxy/files/mediaproxy.in | 35 | ||||
-rw-r--r-- | net/mediaproxy/files/mediaproxy.sh.in | 88 | ||||
-rw-r--r-- | net/mediaproxy/files/proxydispatcher.in | 33 |
4 files changed, 75 insertions, 92 deletions
diff --git a/net/mediaproxy/Makefile b/net/mediaproxy/Makefile index eb91823f73df..4fb215eec6f1 100644 --- a/net/mediaproxy/Makefile +++ b/net/mediaproxy/Makefile @@ -6,7 +6,7 @@ PORTNAME= mediaproxy PORTVERSION= 1.8.2 -PORTREVISION= 3 +PORTREVISION= 4 CATEGORIES= net MASTER_SITES= http://mediaproxy.ag-projects.com/ \ http://mediaproxy.ag-projects.com/old/ @@ -14,12 +14,12 @@ MASTER_SITES= http://mediaproxy.ag-projects.com/ \ MAINTAINER= steve@energistic.com COMMENT= A far-end NAT traversal solution for SER/OpenSER -USE_RC_SUBR= mediaproxy.sh - -WRKSRC= ${WRKDIR}/${PORTNAME} +USE_RC_SUBR= mediaproxy proxydispatcher USE_PYTHON= 2.5+ +SUB_LIST+= PYTHON_CMD=${PYTHON_CMD} + OPTIONS= ACCOUNTING "ACCOUNTING support (Requires MySQL)" off .include <bsd.port.pre.mk> @@ -28,6 +28,9 @@ OPTIONS= ACCOUNTING "ACCOUNTING support (Requires MySQL)" off USE_MYSQL= yes .endif +post-extract: + @${MV} ${WRKDIR}/${PORTNAME} ${WRKSRC} + post-install: ${CP} -pRP ${WRKSRC}/ ${PREFIX}/mediaproxy ${CHOWN} -R 0:0 ${PREFIX}/mediaproxy diff --git a/net/mediaproxy/files/mediaproxy.in b/net/mediaproxy/files/mediaproxy.in new file mode 100644 index 000000000000..b63c7461e851 --- /dev/null +++ b/net/mediaproxy/files/mediaproxy.in @@ -0,0 +1,35 @@ +#!/bin/sh + +# $FreeBSD$ +# +# PROVIDE: mediaproxy +# REQUIRE: LOGIN +# KEYWORD: shutdown +# +# mediaproxy starts and stops the SER MediaProxy server +# +# Add the following line to /etc/rc.conf to enable mediaproxy: +# mediaproxy_enable (bool): Set to "NO" by default. +# Set it to "YES" to enable mediaproxy. +# +# mediaproxy_flags (string): Set command line options + +. /etc/rc.subr + +name="mediaproxy" +rcvar="${name}_enable" + +load_rc_config $name + +: ${mediaproxy_enable="NO"} + +pidfile="/var/run/${name}.pid" + +command="%%PREFIX%%/mediaproxy/mediaproxy.py" +command_interpreter="%%PYTHON_CMD%%" +command_args="--pid $pidfile" + +start_postcmd="%%PREFIX%%/etc/rc.d/proxydispatcher onestart" +stop_postcmd="%%PREFIX%%/etc/rc.d/proxydispatcher stop" + +run_rc_command "$1" diff --git a/net/mediaproxy/files/mediaproxy.sh.in b/net/mediaproxy/files/mediaproxy.sh.in deleted file mode 100644 index 002b29e3a1e9..000000000000 --- a/net/mediaproxy/files/mediaproxy.sh.in +++ /dev/null @@ -1,88 +0,0 @@ -#!/bin/sh - -# $FreeBSD$ -# -# mediaproxy starts and stops the SER MediaProxy server - -# PROVIDE: mediaproxy - -# Add the following line to /etc/rc.conf to enable mysql: -# mediaproxy_enable (bool): Set to "NO" by default. -# Set it to "YES" to enable mediaproxy. - -. /etc/rc.subr - -name="mediaproxy" -rcvar=`set_rcvar` - -load_rc_config $name - -: ${mediaproxy_enable="NO"} - -INSTALL_DIR="%%PREFIX%%" -RUNTIME_DIR="/var/run" - -PROXY="$INSTALL_DIR/mediaproxy/mediaproxy.py" -DISPATCHER="$INSTALL_DIR/mediaproxy/proxydispatcher.py" -PROXY_PID="$RUNTIME_DIR/mediaproxy.pid" -DISPATCHER_PID="$RUNTIME_DIR/proxydispatcher.pid" - -# Options for mediaproxy and dispatcher. Do not include --pid <pidfile> -# --pid <pidfile> will be added automatically if needed. -PROXY_OPTIONS="" -DISPATCHER_OPTIONS="" - -NAME="mediaproxy" -DESC="SER MediaProxy server" - -echo $PROXY -test -f $PROXY || exit 0 -test -f $DISPATCHER || exit 0 - -if [ "$PROXY_PID" != "/var/run/mediaproxy.pid" ]; then - PROXY_OPTIONS="--pid $PROXY_PID $PROXY_OPTIONS" -fi -if [ "$DISPATCHER_PID" != "/var/run/proxydispatcher.pid" ]; then - DISPATCHER_OPTIONS="--pid $DISPATCHER_PID $DISPATCHER_OPTIONS" -fi - -start() { - if [ $mediaproxy_enable = "YES" ]; then - echo -n "Starting $DESC: $NAME" - $PROXY $PROXY_OPTIONS - $DISPATCHER $DISPATCHER_OPTIONS - echo "." - fi -} - -stop () { - echo -n "Stopping $DESC: $NAME" - if [ -f $PROXY_PID ]; then - kill `cat $PROXY_PID` - fi - if [ -f $DISPATCHER_PID ]; then - kill `cat $DISPATCHER_PID` - fi - echo "." -} - -case "$1" in - start) - start - ;; - stop) - stop - ;; - restart|force-reload) - stop - #sleep 1 - start - ;; - *) - echo "Usage: ${INSTALL_DIR}/etc/rc.d/$NAME {start|stop|restart|force-reload}" >&2 - exit 1 - ;; -esac - -exit 0 - diff --git a/net/mediaproxy/files/proxydispatcher.in b/net/mediaproxy/files/proxydispatcher.in new file mode 100644 index 000000000000..e5ea7a1684af --- /dev/null +++ b/net/mediaproxy/files/proxydispatcher.in @@ -0,0 +1,33 @@ +#!/bin/sh + +# $FreeBSD$ +# +# PROVIDE: proxydispatcher +# REQUIRE: mediaproxy +# KEYWORD: nostart +# +# proxydispatcher starts and stops the SER MediaProxy dispatcher +# +# This script is usually run by %%PREFIX%%/etc/rc.d/mediaproxy +# +# Add the following line to /etc/rc.conf to enable proxydispatcher: +# proxydispatcher_enable (bool): Set to "NO" by default. +# Set it to "YES" to enable dispatcher. +# proxydispatcher_flags (string): Set command line options + +. /etc/rc.subr + +name="proxydispatcher" +rcvar="${name}_enable" + +load_rc_config $name + +: ${proxydispatcher_enable="NO"} + +pidfile="/var/run/${name}.pid" + +command="%%PREFIX%%/mediaproxy/proxydispatcher.py" +command_interpreter="%%PYTHON_CMD%%" +command_args="--pid $pidfile" + +run_rc_command "$1" |