From owner-svn-ports-all@FreeBSD.ORG Thu Mar 12 14:33:32 2015 Return-Path: Delivered-To: svn-ports-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 595972CB; Thu, 12 Mar 2015 14:33:32 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 39B3C126; Thu, 12 Mar 2015 14:33:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t2CEXWlK031423; Thu, 12 Mar 2015 14:33:32 GMT (envelope-from demon@FreeBSD.org) Received: (from demon@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t2CEXVbi031421; Thu, 12 Mar 2015 14:33:31 GMT (envelope-from demon@FreeBSD.org) Message-Id: <201503121433.t2CEXVbi031421@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: demon set sender to demon@FreeBSD.org using -f From: Dmitry Sivachenko Date: Thu, 12 Mar 2015 14:33:31 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r381094 - in head/net/haproxy-devel: . files X-SVN-Group: ports-head 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.18-1 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: Thu, 12 Mar 2015 14:33:32 -0000 Author: demon Date: Thu Mar 12 14:33:31 2015 New Revision: 381094 URL: https://svnweb.freebsd.org/changeset/ports/381094 QAT: https://qat.redports.org/buildarchive/r381094/ Log: Sync with net/haproxy Modified: head/net/haproxy-devel/Makefile head/net/haproxy-devel/files/haproxy.in Modified: head/net/haproxy-devel/Makefile ============================================================================== --- head/net/haproxy-devel/Makefile Thu Mar 12 14:17:15 2015 (r381093) +++ head/net/haproxy-devel/Makefile Thu Mar 12 14:33:31 2015 (r381094) @@ -3,7 +3,7 @@ PORTNAME= haproxy DISTVERSION= 1.5.0 -CATEGORIES= net +CATEGORIES= net www MASTER_SITES= http://haproxy.1wt.eu/download/1.5/src/ PKGNAMESUFFIX= -devel @@ -20,7 +20,7 @@ CONFLICTS= haproxy-[1234567890]\* USE_RC_SUBR= haproxy SUB_FILES= pkg-message -OPTIONS_DEFINE= OPENSSL +OPTIONS_DEFINE= OPENSSL DOCS OPTIONS_RADIO= PCRE OPTIONS_RADIO_PCRE= DPCRE SPCRE DPCRE_DESC= Link dynamically Modified: head/net/haproxy-devel/files/haproxy.in ============================================================================== --- head/net/haproxy-devel/files/haproxy.in Thu Mar 12 14:17:15 2015 (r381093) +++ head/net/haproxy-devel/files/haproxy.in Thu Mar 12 14:33:31 2015 (r381094) @@ -7,73 +7,93 @@ # REQUIRE: DAEMON LOGIN # KEYWORD: shutdown -####### # # Add the following lines to /etc/rc.conf to enable haproxy: # # haproxy_enable (bool): default: "NO" # Set to "YES" to enable haproxy -# haproxy_pidfile (str): default: /var/run/${name}.pid +# haproxy_pidfile (str): default: /var/run/haproxy.pid # Set to the full path of the pid file -# haproxy_config (str): default: /usr/local/etc/${name}.conf +# haproxy_config (str): default: %%PREFIX%%/etc/haproxy.conf # Set to the full path of the config file # haproxy_flags (str): default: Autogenerated using pidfile and config options # Set to override with your own options -# -####### -# -# rc.d Script Runtime Options: -# -# start - starts application normally -# stop - (softstop) stops all proxies and exits once all sessions are closed -# forcestop - (immediate) stops all proxies and kills active sessions -# reload - hot-reconfig using "-sf" option (active sessions kept) -# forcereload - hot-reconfig using "-st" option (active sessions killed) -# restart - equiv to "stop" then "start" -# configtest - checks configuration file defined in haproxy_config -# -####### +# haproxy_profiles (str): default: empty +# Set to space-separated list of profiles: for each profile separate haproxy +# process will be spawned, with haproxy-${profile}.conf config file. +# You can override default pidfile and config file for each profile with +# haproxy_${profile}_config and haproxy_${profile}_pidfile. . /etc/rc.subr name="haproxy" rcvar=haproxy_enable command="%%PREFIX%%/sbin/haproxy" +extra_commands="reload configtest" +reload_cmd="haproxy_reload" +stop_cmd="haproxy_stop" -# Load Configs/Set Defaults -load_rc_config $name : ${haproxy_enable:="NO"} -pidfile=${haproxy_pidfile:-"/var/run/haproxy.pid"} : ${haproxy_config:="%%PREFIX%%/etc/${name}.conf"} -: ${haproxy_flags="-q -f ${haproxy_config} -p ${pidfile}"} -procname=${command} +pidfile=${haproxy_pidfile:-"/var/run/haproxy.pid"} -# Update the globals -required_files=$haproxy_config +if [ -z "$rc_force" ]; then + sig_stop="USR1" +fi -# Commands: start, stop, restart, reload, configtest -extra_commands="reload configtest" +load_rc_config $name +is_valid_profile() { + local profile + for profile in $haproxy_profiles; do + if [ "$profile" = "$1" ]; then + return 0 + fi + done + return 1 +} + +if [ -n "$2" ]; then + profile=$2 + if ! is_valid_profile $profile; then + echo "$0: no such profile ($profile) defined in ${name}_profiles." + exit 1 + fi + eval haproxy_config="\${haproxy_${profile}_config:-%%PREFIX%%/etc/haproxy-${profile}.conf}" + eval pidfile="\${haproxy_${profile}_pidfile:-/var/run/haproxy-${profile}.pid}" +else + if [ "x${haproxy_profiles}" != "x" -a "x$1" != "x" ]; then + for profile in ${haproxy_profiles}; do + echo "===> ${name} profile: ${profile}" + %%PREFIX%%/etc/rc.d/haproxy $1 ${profile} + retcode="$?" + if [ ${retcode} -ne 0 ]; then + failed="${profile} (${retcode}) ${failed:-}" + else + success="${profile} ${success:-}" + fi + done + exit 0 + fi +fi + +: ${haproxy_flags:="-q -f ${haproxy_config} -p ${pidfile}"} configtest_cmd="$command -c -f $haproxy_config" start_precmd="$command -q -c -f $haproxy_config" -reload_cmd="haproxy_reload" - -# For stopping, SIGUSR1 = softstop, SIGTERM = faststop -sig_stop=${rc_force:-USR1} +required_files=$haproxy_config haproxy_reload() { - # Check configuration file quietly first ${command} -q -c -f ${haproxy_config} if [ $? -ne 0 ]; then err 1 "Error found in ${haproxy_config} - not reloading current process!" fi rc_pid=$(check_pidfile ${pidfile} ${command}) if [ $rc_pid ]; then - if [ $rc_force ]; then - ${command} ${haproxy_flags} -st $(cat ${pidfile}) - else + if [ -z "$rc_force" ]; then ${command} ${haproxy_flags} -sf $(cat ${pidfile}) + else + ${command} ${haproxy_flags} -st $(cat ${pidfile}) fi else _run_rc_notrunning @@ -81,4 +101,17 @@ haproxy_reload() fi } +haproxy_stop() +{ + rc_pid=$(check_pidfile ${pidfile} ${command}) + if [ $rc_pid ]; then + rc_pid=$(cat ${pidfile}) + kill -$sig_stop $rc_pid + wait_for_pids $rc_pid + else + _run_rc_notrunning + return 1 + fi +} + run_rc_command "$1"