Index: head/databases/redis/Makefile =================================================================== --- head/databases/redis/Makefile (revision 401019) +++ head/databases/redis/Makefile (revision 401020) @@ -1,109 +1,109 @@ # Created by: Sergey Skvortsov # $FreeBSD$ PORTNAME= redis DISTVERSION= 3.0.5 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= databases MASTER_SITES= http://download.redis.io/releases/ MAINTAINER= osa@FreeBSD.org COMMENT= Persistent key-value database with built-in net interface LICENSE= BSD3CLAUSE USES= execinfo OPTIONS_DEFINE= TESTS TRIB OPTIONS_RADIO= EXTLUA OPTIONS_RADIO_EXTLUA= LUA LUAJIT OPTIONS_SUB= yes LUA_DESC= Use lang/lua instead of builtin lua LUAJIT_DESC= Use lang/luajit instead of builtin lua TESTS_DESC= Install lang/tcl for redis unit tests TRIB_DESC= Install redis-trib.rb (lang/ruby req.) .include .if ${PORT_OPTIONS:MTRIB} CATEGORIES+= ruby USE_RUBY= yes RUN_DEPENDS= rubygem-redis>=2.2:${PORTSDIR}/databases/rubygem-redis .endif .if ${PORT_OPTIONS:MLUA} USES+= lua:51 EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-src-Makefile.lua .endif .if ${PORT_OPTIONS:MLUAJIT} LIB_DEPENDS+= libluajit-5.1.so:${PORTSDIR}/lang/luajit EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-src-Makefile.luajit .endif .if ${PORT_OPTIONS:MLUA} || ${PORT_OPTIONS:MLUAJIT} CFLAGS+= -fPIC LDFLAGS+= -Wl,-E .endif .if ${PORT_OPTIONS:MTESTS} USES+= tcl:build .endif CFLAGS+= -I${LOCALBASE}/include LDFLAGS+= -L${LOCALBASE}/lib -lpthread -lm -lexecinfo CONFLICTS?= redis-devel-3.* USES+= gmake MAKE_ENV= "V=yo" USE_RC_SUBR= redis sentinel BIN_FILES= redis-benchmark redis-check-aof redis-check-dump \ redis-cli redis-sentinel redis-server PKGMESSAGE= ${WRKDIR}/pkg-message USERS= redis GROUPS= redis REDIS_DBDIR?= /var/db/redis REDIS_RUNDIR?= /var/run/redis REDIS_LOGDIR?= /var/log/redis SUB_FILES= pkg-message SUB_LIST+= PORTNAME=${PORTNAME} \ REDIS_USER=${USERS} \ REDIS_DBDIR=${REDIS_DBDIR} \ REDIS_LOGDIR=${REDIS_LOGDIR} \ REDIS_RUNDIR=${REDIS_RUNDIR} PLIST_SUB+= REDIS_USER=${USERS} \ REDIS_GROUP=${GROUPS} \ REDIS_LOGDIR=${REDIS_LOGDIR} \ REDIS_DBDIR=${REDIS_DBDIR} \ REDIS_RUNDIR=${REDIS_RUNDIR} .if ${PORT_OPTIONS:MLUAJIT} || ${PORT_OPTIONS:MLUA} post-patch: @cd ${WRKSRC}/deps/lua/src && ${CP} fpconv.* lua_* strbuf.* ${WRKSRC}/src/ .endif post-build: ${SED} ${SUB_LIST:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ ${WRKSRC}/redis.conf > ${WRKDIR}/redis.conf do-install: ${INSTALL_PROGRAM} ${BIN_FILES:C!^!${WRKSRC}/src/!} ${STAGEDIR}${PREFIX}/bin/ .if ${PORT_OPTIONS:MTRIB} ${INSTALL_SCRIPT} ${WRKSRC}/src/redis-trib.rb ${STAGEDIR}${PREFIX}/bin/ .endif ${INSTALL_DATA} ${WRKDIR}/redis.conf ${STAGEDIR}${PREFIX}/etc/redis.conf.sample ${INSTALL_DATA} ${WRKSRC}/sentinel.conf ${STAGEDIR}${PREFIX}/etc/sentinel.conf.sample ${MKDIR} ${STAGEDIR}${REDIS_LOGDIR} \ ${STAGEDIR}${REDIS_DBDIR} \ ${STAGEDIR}${REDIS_RUNDIR} regression-test: build @cd ${WRKSRC} && ${TCLSH} tests/test_helper.tcl .include Index: head/databases/redis/files/redis.in =================================================================== --- head/databases/redis/files/redis.in (revision 401019) +++ head/databases/redis/files/redis.in (revision 401020) @@ -1,34 +1,70 @@ #!/bin/sh # # $FreeBSD$ # # PROVIDE: redis # REQUIRE: LOGIN # BEFORE: securelevel # KEYWORD: shutdown # Add the following line to /etc/rc.conf to enable `redis': # #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 name="redis" rcvar="${name}_enable" extra_commands="reload" command="%%PREFIX%%/bin/redis-server" pidfile="%%REDIS_RUNDIR%%/$name.pid" # read configuration and set defaults load_rc_config "$name" : ${redis_enable="NO"} : ${redis_user="%%REDIS_USER%%"} : ${redis_config="%%PREFIX%%/etc/$name.conf"} 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" Index: head/databases/redis-devel/Makefile =================================================================== --- head/databases/redis-devel/Makefile (revision 401019) +++ head/databases/redis-devel/Makefile (revision 401020) @@ -1,110 +1,110 @@ # Created by: Sergey Skvortsov # $FreeBSD$ PORTNAME= redis DISTVERSION= 3.0.5 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= databases MASTER_SITES= http://download.redis.io/releases/ PKGNAMESUFFIX= -devel MAINTAINER= osa@FreeBSD.org COMMENT= Persistent key-value database with built-in net interface LICENSE= BSD3CLAUSE USES= execinfo OPTIONS_DEFINE= TESTS TRIB OPTIONS_RADIO= EXTLUA OPTIONS_RADIO_EXTLUA= LUA LUAJIT OPTIONS_SUB= yes LUA_DESC= Use lang/lua instead of builtin lua LUAJIT_DESC= Use lang/luajit instead of builtin lua TESTS_DESC= Install lang/tcl for redis unit tests TRIB_DESC= Install redis-trib.rb (lang/ruby req.) .include .if ${PORT_OPTIONS:MTRIB} CATEGORIES+= ruby USE_RUBY= yes RUN_DEPENDS= rubygem-redis>=2.2:${PORTSDIR}/databases/rubygem-redis .endif .if ${PORT_OPTIONS:MLUA} USES+= lua:51 EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-src-Makefile.lua .endif .if ${PORT_OPTIONS:MLUAJIT} LIB_DEPENDS+= libluajit-5.1.so:${PORTSDIR}/lang/luajit EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-src-Makefile.luajit .endif .if ${PORT_OPTIONS:MLUA} || ${PORT_OPTIONS:MLUAJIT} CFLAGS+= -fPIC LDFLAGS+= -Wl,-E .endif .if ${PORT_OPTIONS:MTESTS} USES+= tcl:build .endif CFLAGS+= -I${LOCALBASE}/include LDFLAGS+= -L${LOCALBASE}/lib -lpthread -lm -lexecinfo CONFLICTS?= redis-3.* USES+= gmake MAKE_ENV= "V=yo" USE_RC_SUBR= redis sentinel BIN_FILES= redis-benchmark redis-check-aof redis-check-dump \ redis-cli redis-sentinel redis-server PKGMESSAGE= ${WRKDIR}/pkg-message USERS= redis GROUPS= redis REDIS_DBDIR?= /var/db/redis REDIS_RUNDIR?= /var/run/redis REDIS_LOGDIR?= /var/log/redis SUB_FILES= pkg-message SUB_LIST+= PORTNAME=${PORTNAME} \ REDIS_USER=${USERS} \ REDIS_DBDIR=${REDIS_DBDIR} \ REDIS_LOGDIR=${REDIS_LOGDIR} \ REDIS_RUNDIR=${REDIS_RUNDIR} PLIST_SUB+= REDIS_USER=${USERS} \ REDIS_GROUP=${GROUPS} \ REDIS_LOGDIR=${REDIS_LOGDIR} \ REDIS_DBDIR=${REDIS_DBDIR} \ REDIS_RUNDIR=${REDIS_RUNDIR} .if ${PORT_OPTIONS:MLUAJIT} || ${PORT_OPTIONS:MLUA} post-patch: @cd ${WRKSRC}/deps/lua/src && ${CP} fpconv.* lua_* strbuf.* ${WRKSRC}/src/ .endif post-build: ${SED} ${SUB_LIST:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ ${WRKSRC}/redis.conf > ${WRKDIR}/redis.conf do-install: ${INSTALL_PROGRAM} ${BIN_FILES:C!^!${WRKSRC}/src/!} ${STAGEDIR}${PREFIX}/bin/ .if ${PORT_OPTIONS:MTRIB} ${INSTALL_SCRIPT} ${WRKSRC}/src/redis-trib.rb ${STAGEDIR}${PREFIX}/bin/ .endif ${INSTALL_DATA} ${WRKDIR}/redis.conf ${STAGEDIR}${PREFIX}/etc/redis.conf.sample ${INSTALL_DATA} ${WRKSRC}/sentinel.conf ${STAGEDIR}${PREFIX}/etc/sentinel.conf.sample ${MKDIR} ${STAGEDIR}${REDIS_LOGDIR} \ ${STAGEDIR}${REDIS_DBDIR} \ ${STAGEDIR}${REDIS_RUNDIR} regression-test: build @cd ${WRKSRC} && ${TCLSH} tests/test_helper.tcl .include Index: head/databases/redis-devel/files/redis.in =================================================================== --- head/databases/redis-devel/files/redis.in (revision 401019) +++ head/databases/redis-devel/files/redis.in (revision 401020) @@ -1,34 +1,70 @@ #!/bin/sh # # $FreeBSD$ # # PROVIDE: redis # REQUIRE: LOGIN # BEFORE: securelevel # KEYWORD: shutdown # Add the following line to /etc/rc.conf to enable `redis': # #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 name="redis" rcvar="${name}_enable" extra_commands="reload" command="%%PREFIX%%/bin/redis-server" pidfile="%%REDIS_RUNDIR%%/$name.pid" # read configuration and set defaults load_rc_config "$name" : ${redis_enable="NO"} : ${redis_user="%%REDIS_USER%%"} : ${redis_config="%%PREFIX%%/etc/$name.conf"} 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"