From owner-freebsd-ports-bugs@FreeBSD.ORG Thu May 21 01:00:11 2009 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 74ABD1065672 for ; Thu, 21 May 2009 01:00:11 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 385BE8FC1A for ; Thu, 21 May 2009 01:00:11 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n4L10BjL098386 for ; Thu, 21 May 2009 01:00:11 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n4L10BCd098385; Thu, 21 May 2009 01:00:11 GMT (envelope-from gnats) Resent-Date: Thu, 21 May 2009 01:00:11 GMT Resent-Message-Id: <200905210100.n4L10BCd098385@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, "Ryan T.Dean" Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0026A1065672 for ; Thu, 21 May 2009 00:57:34 +0000 (UTC) (envelope-from rtdean@noisy.cytherianage.net) Received: from noisy.cytherianage.net (noisy.cytherianage.net [209.222.140.14]) by mx1.freebsd.org (Postfix) with ESMTP id BC19F8FC0C for ; Thu, 21 May 2009 00:57:34 +0000 (UTC) (envelope-from rtdean@noisy.cytherianage.net) Received: (qmail 8887 invoked by uid 1000); 21 May 2009 00:57:34 -0000 Message-Id: <20090521005734.8886.qmail@noisy.cytherianage.net> Date: 21 May 2009 00:57:34 -0000 From: "Ryan T.Dean" To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: marcus@FreeBSD.org Subject: ports/134768: Update port: net/tac_plus4 add profiles support to rc.d script X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: "Ryan T.Dean" List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 May 2009 01:00:11 -0000 >Number: 134768 >Category: ports >Synopsis: Update port: net/tac_plus4 add profiles support to rc.d script >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: update >Submitter-Id: current-users >Arrival-Date: Thu May 21 01:00:10 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Ryan T. Dean >Release: FreeBSD 7.1-STABLE amd64 >Organization: >Environment: System: FreeBSD noisy.cytherianage.net 7.1-STABLE FreeBSD 7.1-STABLE #3: Sat Jan 10 00:14:55 UTC 2009 root@noisy.cytherianage.net:/usr/obj/usr/src/sys/GENERIC amd64 >Description: The current tac_plus rc.d script is great for starting a single daemon process, however, sometimes you need to run multiple daemons to handle different segments or groups. I've patched the tac_plus rc.d script to add profiles support. >How-To-Repeat: n/a >Fix: --- tac_plus4-rcd-script.patch begins here --- --- ports/net/tac_plus4/files/tac_plus.in 2006-10-31 02:42:33.000000000 +0000 +++ ports/net/tac_plus4/files/tac_plus.in 2009-05-21 00:33:47.000000000 +0000 @@ -2,18 +2,24 @@ # # $FreeBSD: ports/net/tac_plus4/files/tac_plus.in,v 1.1 2006/10/31 02:42:33 marcus Exp $ # + # PROVIDE: tac_plus # REQUIRE: DAEMON + # # Add the following line to /etc/rc.conf to enable the TACACS+ daemon: # -# tac_plus_enable="YES" -# - -tac_plus_enable=${tac_plus_enable-"NO"} -tac_plus_flags=${tac_plus_flags-"-C %%PREFIX%%/etc/tac_plus.conf"} - -. %%RC_SUBR%% +# tac_plus_enable (bool): Set to "NO" by default +# Set it to "YES" to enable tac_plus +# tac_plus_flags (str): Set to "" by default +# Extra flags to be passed to start command +# tac_plus_profiles (str): Set to "" by default +# Allows you to run multiple tac_plus daemons with +# different settings +# tac_plus_configfile (str): Set to "%%PREFIX%%/etc/tac_plus.conf" by default +# Allows you to specify a different config file for +# the tac_plus daemon +. %%RC_SUBR%% name=tac_plus rcvar=`set_rcvar` @@ -21,5 +27,72 @@ command="%%PREFIX%%/bin/tac_plus" pidfile="/var/run/${name}.pid" +tac_plus_enable=${tac_plus_enable:-"NO"} +tac_plus_flags=${tac_plus_flags:-} +tac_plus_profiles=${tac_plus_profiles:-} +tac_plus_configfile=${tac_plus_configfile:-"%%PREFIX%%/etc/tac_plus.conf"} + load_rc_config ${name} + +if [ -n "$2" ]; then + profile="$2" + if [ "x${tac_plus_profiles}" != "x" ]; then + eval tac_plus_configfile="\${tac_plus_${profile}_configfile:-}" + if [ "x${tac_plus_configfile}" = "x" ]; then + echo "You must define a configuration file (tac_plus_${profile}_configfile)" + exit 1 + fi + required_files="${tac_plus_configfile}" + eval tac_plus_enable="\${tac_plus_${profile}_enable:-${tac_plus_enable}}" + eval tac_plus_flags="\${tac_plus_${profile}_flags:-${tac_plus_flags}}" + eval tac_plus_port="\${tac_plus_${profile}_port:-}" + eval tac_plus_ip="\${tac_plus_${profile}_ip:-}" + else + echo "$0: extra argument ignored" + fi +else + if [ "x${tac_plus_profiles}" != "x" -a "x$1" != "x" ]; then + for profile in ${tac_plus_profiles}; do + eval _enable="\${tac_plus_${profile}_enable}" + case "x${_enable:-${tac_plus_enable}}" in + x|x[Nn][Oo]|x[Nn][Oo][Nn][Ee]) + continue + ;; + x[Yy][Ee][Ss]) + ;; + *) + if test -z "$_enable"; then + _var=tac_plus_enable + else + _var=tac_plus_"${profile}"_enable + fi + echo "Bad value "\ + "'${_enable:-${tac_plus_enable}}' "\ + "for ${_var}. "\ + "Profile ${profile} skipped." + continue + esac + echo "====> tac_plus profile: ${profile}" + %%PREFIX%%/etc/rc.d/tac_plus $1 ${profile} + retcode="$?" + if [ "0${retcode}" -ne 0 ]; then + failed="${profile} (${retcode}) ${failed:-}" + else + success="${profile} ${success:-}" + fi + done + exit 0 + fi +fi + +tac_plus_flags="-C ${tac_plus_configfile} ${tac_plus_flags}" +if [ "x${tac_plus_ip}" != "x" ]; then + pidfile="${pidfile}.${tac_plus_ip}" + tac_plus_flags="${tac_plus_flags} -B ${tac_plus_ip}" +fi +if [ "x${tac_plus_port}" != "x" ]; then + pidfile="${pidfile}.${tac_plus_port}" + tac_plus_flags="${tac_plus_flags} -p ${tac_plus_port}" +fi + run_rc_command "$1" --- tac_plus4-rcd-script.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted: