From owner-svn-ports-all@freebsd.org Sat Nov 7 20:08:19 2015 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 B3B58A2850D; Sat, 7 Nov 2015 20:08:19 +0000 (UTC) (envelope-from osa@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 85E961ACB; Sat, 7 Nov 2015 20:08:19 +0000 (UTC) (envelope-from osa@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tA7K8Id2065277; Sat, 7 Nov 2015 20:08:18 GMT (envelope-from osa@FreeBSD.org) Received: (from osa@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tA7K8IoO065272; Sat, 7 Nov 2015 20:08:18 GMT (envelope-from osa@FreeBSD.org) Message-Id: <201511072008.tA7K8IoO065272@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: osa set sender to osa@FreeBSD.org using -f From: "Sergey A. Osokin" Date: Sat, 7 Nov 2015 20:08:18 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r401020 - in head/databases: redis redis-devel redis-devel/files redis/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.20 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: Sat, 07 Nov 2015 20:08:19 -0000 Author: osa Date: Sat Nov 7 20:08:18 2015 New Revision: 401020 URL: https://svnweb.freebsd.org/changeset/ports/401020 Log: Enable profiles support. Bump PORTREVISION. PRs: 171372, 179551 Modified: head/databases/redis-devel/Makefile head/databases/redis-devel/files/redis.in head/databases/redis/Makefile head/databases/redis/files/redis.in Modified: head/databases/redis-devel/Makefile ============================================================================== --- head/databases/redis-devel/Makefile Sat Nov 7 19:12:06 2015 (r401019) +++ head/databases/redis-devel/Makefile Sat Nov 7 20:08:18 2015 (r401020) @@ -3,7 +3,7 @@ PORTNAME= redis DISTVERSION= 3.0.5 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= databases MASTER_SITES= http://download.redis.io/releases/ PKGNAMESUFFIX= -devel Modified: head/databases/redis-devel/files/redis.in ============================================================================== --- head/databases/redis-devel/files/redis.in Sat Nov 7 19:12:06 2015 (r401019) +++ head/databases/redis-devel/files/redis.in Sat Nov 7 20:08:18 2015 (r401020) @@ -12,6 +12,11 @@ # #redis_enable="YES" # +# Define profiles here to run separate redis instances: +# +#redis_profiles="foo bar" # Script uses %%PREFIX%%/etc/redis-NAME.conf respectively. +# For correct script working please update pidfile entries in +# redis-NAME.conf files. . /etc/rc.subr @@ -31,4 +36,35 @@ load_rc_config "$name" command_args="${redis_config}" required_files="${redis_config}" + +_profile_exists() { + for _p in ${redis_profiles}; do + [ "${_p}" = "$1" ] && return 1; + done + return 0 +} + +if [ $# -eq 2 ]; then + _profile=$2 + _profile_exists $_profile + _exists=$? + [ ${_exists} -ne 1 ] && { + echo "`basename %%PREFIX%%/etc/rc.d/redis`: no '$2' in 'redis_profiles'" + exit 1 + }; + echo "-- Profile: ${_profile} --" + config_file="%%PREFIX%%/etc/${name}-${_profile}.conf" + command_args="${config_file}" + pidfile="%%REDIS_RUNDIR%%/${_profile}.pid" + required_files="${config_file}" +elif [ -n "${redis_profiles}" ]; then + _swap=$*; shift; _profiles=$* + _profiles=${_profiles:-${redis_profiles}} + set -- ${_swap} + for _profile in ${_profiles}; do + %%PREFIX%%/etc/rc.d/redis $1 ${_profile} + done + exit 0 +fi + run_rc_command "$1" Modified: head/databases/redis/Makefile ============================================================================== --- head/databases/redis/Makefile Sat Nov 7 19:12:06 2015 (r401019) +++ head/databases/redis/Makefile Sat Nov 7 20:08:18 2015 (r401020) @@ -3,7 +3,7 @@ PORTNAME= redis DISTVERSION= 3.0.5 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= databases MASTER_SITES= http://download.redis.io/releases/ Modified: head/databases/redis/files/redis.in ============================================================================== --- head/databases/redis/files/redis.in Sat Nov 7 19:12:06 2015 (r401019) +++ head/databases/redis/files/redis.in Sat Nov 7 20:08:18 2015 (r401020) @@ -12,6 +12,11 @@ # #redis_enable="YES" # +# Define profiles here to run separate redis instances: +# +#redis_profiles="foo bar" # Script uses %%PREFIX%%/etc/redis-NAME.conf respectively. +# For correct script working please update pidfile entries in +# redis-NAME.conf files. . /etc/rc.subr @@ -31,4 +36,35 @@ load_rc_config "$name" command_args="${redis_config}" required_files="${redis_config}" + +_profile_exists() { + for _p in ${redis_profiles}; do + [ "${_p}" = "$1" ] && return 1; + done + return 0 +} + +if [ $# -eq 2 ]; then + _profile=$2 + _profile_exists $_profile + _exists=$? + [ ${_exists} -ne 1 ] && { + echo "`basename %%PREFIX%%/etc/rc.d/redis`: no '$2' in 'redis_profiles'" + exit 1 + }; + echo "-- Profile: ${_profile} --" + config_file="%%PREFIX%%/etc/${name}-${_profile}.conf" + command_args="${config_file}" + pidfile="%%REDIS_RUNDIR%%/${_profile}.pid" + required_files="${config_file}" +elif [ -n "${redis_profiles}" ]; then + _swap=$*; shift; _profiles=$* + _profiles=${_profiles:-${redis_profiles}} + set -- ${_swap} + for _profile in ${_profiles}; do + %%PREFIX%%/etc/rc.d/redis $1 ${_profile} + done + exit 0 +fi + run_rc_command "$1"