Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Mar 2021 19:27:40 +0000 (UTC)
From:      Yuri Victorovich <yuri@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r567256 - in head/net/coturn: . files
Message-ID:  <202103031927.123JReMG001712@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: yuri
Date: Wed Mar  3 19:27:40 2021
New Revision: 567256
URL: https://svnweb.freebsd.org/changeset/ports/567256

Log:
  net/coturn: rc script fixes
  
  * Fetch pidfile from config file
  * Integrate into ports Makefile correctly
  * Pet rclint
  
  PR:		253978
  Submitted by:	crees

Added:
  head/net/coturn/files/turnserver.in
     - copied, changed from r567255, head/net/coturn/files/turnserver-service.in
Deleted:
  head/net/coturn/files/turnserver-service.in
Modified:
  head/net/coturn/Makefile
  head/net/coturn/pkg-plist

Modified: head/net/coturn/Makefile
==============================================================================
--- head/net/coturn/Makefile	Wed Mar  3 19:14:23 2021	(r567255)
+++ head/net/coturn/Makefile	Wed Mar  3 19:27:40 2021	(r567256)
@@ -2,7 +2,7 @@
 
 PORTNAME=	coturn
 DISTVERSION=	4.5.2
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	net
 
 MAINTAINER=	yuri@FreeBSD.org
@@ -18,11 +18,11 @@ USE_GITHUB=	yes
 
 SHEBANG_FILES=	examples/scripts/oauth.sh examples/scripts/restapi/shared_secret_maintainer.pl
 
+USE_RC_SUBR=	turnserver
+
 GNU_CONFIGURE=	yes
 CONFIGURE_ARGS=	--disable-static --enable-shared --turndbdir=/var/db/${PORTNAME}
 
-SUB_FILES=	turnserver-service
-
 DOCSDIR=	${PREFIX}/share/doc/turnserver
 EXAMPLESDIR=	${PREFIX}/share/examples/turnserver
 
@@ -32,7 +32,6 @@ PORTDOCS=	*
 PORTEXAMPLES=	*
 
 post-install:
-	${INSTALL_SCRIPT} ${WRKDIR}/turnserver-service ${STAGEDIR}${PREFIX}/etc/rc.d/turnserver
 	${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/*
 
 .include <bsd.port.mk>

Copied and modified: head/net/coturn/files/turnserver.in (from r567255, head/net/coturn/files/turnserver-service.in)
==============================================================================
--- head/net/coturn/files/turnserver-service.in	Wed Mar  3 19:14:23 2021	(r567255, copy source)
+++ head/net/coturn/files/turnserver.in	Wed Mar  3 19:27:40 2021	(r567256)
@@ -2,28 +2,36 @@
 #
 # $FreeBSD$
 #
-
-#
 # PROVIDE: turnserver
 # REQUIRE: DAEMON
 # BEFORE: mail
 # KEYWORD: shutdown
-#
 
 . /etc/rc.subr
 
-name="turnserver"
-rcvar="${name}_enable"
-command="%%PREFIX%%/bin/${name}"
-pidfile="/var/run/${name}.pid"
-required_files="%%PREFIX%%/etc/${name}.conf"
+name=turnserver
+rcvar=turnserver_enable
+desc=TURN and STUN server
 
 load_rc_config ${name}
 
-: ${turnserver_enable="NO"}
-: ${turnserver_flags="-o"}
+: ${turnserver_enable:="NO"}
 : ${turnserver_configfile:=%%PREFIX%%/etc/$name.conf}
 
-command_args="-c ${turnserver_configfile} ${turnserver_flags}"
+command="%%PREFIX%%/bin/${name}"
+required_files="%%PREFIX%%/etc/${name}.conf"
+start_precmd=find_pidfile
+stop_precmd=find_pidfile
+status_precmd=find_pidfile
+command_args="-o -c ${turnserver_configfile}"
+
+find_pidfile()
+{
+        if get_pidfile_from_conf pidfile $turnserver_configfile; then
+                pidfile="$_pidfile_from_conf"
+        else
+                pidfile="/var/run/${name}.pid"
+        fi
+}
 
 run_rc_command "$1"

Modified: head/net/coturn/pkg-plist
==============================================================================
--- head/net/coturn/pkg-plist	Wed Mar  3 19:14:23 2021	(r567255)
+++ head/net/coturn/pkg-plist	Wed Mar  3 19:27:40 2021	(r567256)
@@ -5,7 +5,6 @@ bin/turnutils_oauth
 bin/turnutils_peer
 bin/turnutils_stunclient
 bin/turnutils_uclient
-etc/rc.d/turnserver
 @sample etc/turnserver.conf.default etc/turnserver.conf
 include/turn/client/TurnMsgLib.h
 include/turn/client/ns_turn_ioaddr.h



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202103031927.123JReMG001712>