From owner-svn-ports-all@freebsd.org Sun Aug 27 20:35:40 2017 Return-Path: Delivered-To: svn-ports-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4178EDF7AB4; Sun, 27 Aug 2017 20:35:40 +0000 (UTC) (envelope-from madpilot@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1C05381CBD; Sun, 27 Aug 2017 20:35:40 +0000 (UTC) (envelope-from madpilot@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7RKZdbD042530; Sun, 27 Aug 2017 20:35:39 GMT (envelope-from madpilot@FreeBSD.org) Received: (from madpilot@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7RKZcg9042524; Sun, 27 Aug 2017 20:35:38 GMT (envelope-from madpilot@FreeBSD.org) Message-Id: <201708272035.v7RKZcg9042524@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: madpilot set sender to madpilot@FreeBSD.org using -f From: Guido Falsi Date: Sun, 27 Aug 2017 20:35:38 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-branches@freebsd.org Subject: svn commit: r448842 - in branches/2017Q3/net: asterisk11 asterisk11/files asterisk13 asterisk13/files X-SVN-Group: ports-branches X-SVN-Commit-Author: madpilot X-SVN-Commit-Paths: in branches/2017Q3/net: asterisk11 asterisk11/files asterisk13 asterisk13/files X-SVN-Commit-Revision: 448842 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Aug 2017 20:35:40 -0000 Author: madpilot Date: Sun Aug 27 20:35:38 2017 New Revision: 448842 URL: https://svnweb.freebsd.org/changeset/ports/448842 Log: MFH: r448520 Make the provided rc script more robust. Also add an asterisk_stopsleep knob (disabled by default) to allow users to work around a possible race condition when asterisk is sent a stop command just after launching, but before it's startup is actually completed. PR: 221271 Submitted by: O. Hartmann Approved by: ports-secteam (delphij) Modified: branches/2017Q3/net/asterisk11/Makefile branches/2017Q3/net/asterisk11/files/asterisk.in branches/2017Q3/net/asterisk13/Makefile branches/2017Q3/net/asterisk13/files/asterisk.in Directory Properties: branches/2017Q3/ (props changed) Modified: branches/2017Q3/net/asterisk11/Makefile ============================================================================== --- branches/2017Q3/net/asterisk11/Makefile Sun Aug 27 20:33:36 2017 (r448841) +++ branches/2017Q3/net/asterisk11/Makefile Sun Aug 27 20:35:38 2017 (r448842) @@ -2,7 +2,7 @@ PORTNAME= asterisk PORTVERSION= 11.25.1 -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= net MASTER_SITES= http://downloads.asterisk.org/pub/telephony/%SUBDIR%/:DEFAULT,g729 MASTER_SITE_SUBDIR= asterisk/ \ Modified: branches/2017Q3/net/asterisk11/files/asterisk.in ============================================================================== --- branches/2017Q3/net/asterisk11/files/asterisk.in Sun Aug 27 20:33:36 2017 (r448841) +++ branches/2017Q3/net/asterisk11/files/asterisk.in Sun Aug 27 20:35:38 2017 (r448842) @@ -17,6 +17,8 @@ # Default is "-n" # asterisk_pidfile (string): Location of the asterisk pid file # Default is /var/run/asterisk/asterisk.pid +# asterisk_stopsleep (int): Number of seconds to sleep before sending stop command +# Default is 0, which disables it # . /etc/rc.subr @@ -31,6 +33,7 @@ load_rc_config $name : ${asterisk_user:=%%ASTERISK_USER%%} : ${asterisk_args=-n} : ${asterisk_pidfile:=/var/run/asterisk/asterisk.pid} +: ${asterisk_stopsleep:=0} extra_commands=reload @@ -52,13 +55,26 @@ asterisk_precmd() asterisk_stop() { - echo 'Stopping asterisk' + if [ -z "$rc_pid" ]; then + [ -n "$rc_fast" ] && return 0 + _run_rc_notrunning + return 1 + fi + echo 'Stopping asterisk.' + if [ ${asterisk_stopsleep} > 0 ]; then + sleep ${asterisk_stopsleep} + fi $command -nqrx 'core stop now' + wait_for_pids $rc_pid } asterisk_reload() { - echo 'Reloading asterisk' + if [ -z "$rc_pid" ]; then + _run_rc_notrunning + return 1 + fi + echo 'Reloading asterisk.' $command -nqrx 'reload' } Modified: branches/2017Q3/net/asterisk13/Makefile ============================================================================== --- branches/2017Q3/net/asterisk13/Makefile Sun Aug 27 20:33:36 2017 (r448841) +++ branches/2017Q3/net/asterisk13/Makefile Sun Aug 27 20:35:38 2017 (r448842) @@ -2,6 +2,7 @@ PORTNAME= asterisk PORTVERSION= 13.16.0 +PORTREVISION= 1 CATEGORIES= net MASTER_SITES= http://downloads.asterisk.org/pub/telephony/%SUBDIR%/:DEFAULT,g729 MASTER_SITE_SUBDIR= asterisk/ \ Modified: branches/2017Q3/net/asterisk13/files/asterisk.in ============================================================================== --- branches/2017Q3/net/asterisk13/files/asterisk.in Sun Aug 27 20:33:36 2017 (r448841) +++ branches/2017Q3/net/asterisk13/files/asterisk.in Sun Aug 27 20:35:38 2017 (r448842) @@ -17,6 +17,8 @@ # Default is "-n" # asterisk_pidfile (string): Location of the asterisk pid file # Default is /var/run/asterisk/asterisk.pid +# asterisk_stopsleep (int): Number of seconds to sleep before sending stop command +# Default is 0, which disables it # . /etc/rc.subr @@ -31,6 +33,7 @@ load_rc_config $name : ${asterisk_user:=%%ASTERISK_USER%%} : ${asterisk_args=-n} : ${asterisk_pidfile:=/var/run/asterisk/asterisk.pid} +: ${asterisk_stopsleep:=0} extra_commands=reload @@ -52,13 +55,26 @@ asterisk_precmd() asterisk_stop() { - echo 'Stopping asterisk' + if [ -z "$rc_pid" ]; then + [ -n "$rc_fast" ] && return 0 + _run_rc_notrunning + return 1 + fi + echo 'Stopping asterisk.' + if [ ${asterisk_stopsleep} > 0 ]; then + sleep ${asterisk_stopsleep} + fi $command -nqrx 'core stop now' + wait_for_pids $rc_pid } asterisk_reload() { - echo 'Reloading asterisk' + if [ -z "$rc_pid" ]; then + _run_rc_notrunning + return 1 + fi + echo 'Reloading asterisk.' $command -nqrx 'reload' }