From 6d6485b55600796d513b2f5eb189f533ad80516a Mon Sep 17 00:00:00 2001 From: "Sergey A. Osokin" Date: Thu, 29 Oct 2015 01:34:53 +0000 Subject: Add rc script for sentinel. Bump PORTREVISION. PR: 204025 --- databases/redis-devel/Makefile | 3 ++- databases/redis-devel/files/sentinel.in | 42 +++++++++++++++++++++++++++++++++ databases/redis-devel/pkg-plist | 2 +- databases/redis/Makefile | 3 ++- databases/redis/files/sentinel.in | 42 +++++++++++++++++++++++++++++++++ databases/redis/pkg-plist | 2 +- 6 files changed, 90 insertions(+), 4 deletions(-) create mode 100644 databases/redis-devel/files/sentinel.in create mode 100644 databases/redis/files/sentinel.in diff --git a/databases/redis-devel/Makefile b/databases/redis-devel/Makefile index f0f046abe991..bb67b4835246 100644 --- a/databases/redis-devel/Makefile +++ b/databases/redis-devel/Makefile @@ -3,6 +3,7 @@ PORTNAME= redis DISTVERSION= 3.0.5 +PORTREVISION= 1 CATEGORIES= databases MASTER_SITES= http://download.redis.io/releases/ PKGNAMESUFFIX= -devel @@ -57,7 +58,7 @@ CONFLICTS?= redis-3.* USES+= gmake MAKE_ENV= "V=yo" -USE_RC_SUBR= redis +USE_RC_SUBR= redis sentinel BIN_FILES= redis-benchmark redis-check-aof redis-check-dump \ redis-cli redis-sentinel redis-server diff --git a/databases/redis-devel/files/sentinel.in b/databases/redis-devel/files/sentinel.in new file mode 100644 index 000000000000..b66ae1492b01 --- /dev/null +++ b/databases/redis-devel/files/sentinel.in @@ -0,0 +1,42 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: sentinel +# REQUIRE: LOGIN +# BEFORE: securelevel +# KEYWORD: shutdown + +# Add the following line to /etc/rc.conf to enable `sentinel': +# +#sentinel_enable="YES" +# + +. /etc/rc.subr + +name="sentinel" +rcvar="${name}_enable" + +command="/usr/local/bin/redis-sentinel" +pidfile="/var/run/redis/$name.pid" + +# read configuration and set defaults +load_rc_config "$name" +: ${sentinel_enable="NO"} +: ${sentinel_user="redis"} +: ${sentinel_config="/usr/local/etc/$name.conf"} + +command_args="${sentinel_config} --daemonize yes --pidfile ${pidfile}" +required_files="${sentinel_config}" +start_precmd="${name}_checks" +restart_precmd="${name}_checks" + +sentinel_checks() +{ + if [ x`id -u ${sentinel_user}` != x`stat -f %u ${sentinel_config}` ]; then + err 1 "${sentinel_config} must be owned by user ${sentinel_user}" + fi +} + +run_rc_command "$1" diff --git a/databases/redis-devel/pkg-plist b/databases/redis-devel/pkg-plist index adbb8f3a38b7..38dadc750ab7 100644 --- a/databases/redis-devel/pkg-plist +++ b/databases/redis-devel/pkg-plist @@ -6,7 +6,7 @@ bin/redis-sentinel bin/redis-server %%TRIB%%bin/redis-trib.rb @sample etc/redis.conf.sample -@sample etc/sentinel.conf.sample +@sample(%%REDIS_USER%%,%%REDIS_GROUP%%,) etc/sentinel.conf.sample @dir(%%REDIS_USER%%,%%REDIS_GROUP%%,) %%REDIS_DBDIR%% @dir(%%REDIS_USER%%,%%REDIS_GROUP%%,) %%REDIS_LOGDIR%% @dir(%%REDIS_USER%%,%%REDIS_GROUP%%,) %%REDIS_RUNDIR%% diff --git a/databases/redis/Makefile b/databases/redis/Makefile index d9b83328b822..b6650d5233c6 100644 --- a/databases/redis/Makefile +++ b/databases/redis/Makefile @@ -3,6 +3,7 @@ PORTNAME= redis DISTVERSION= 3.0.5 +PORTREVISION= 1 CATEGORIES= databases MASTER_SITES= http://download.redis.io/releases/ @@ -56,7 +57,7 @@ CONFLICTS?= redis-devel-3.* USES+= gmake MAKE_ENV= "V=yo" -USE_RC_SUBR= redis +USE_RC_SUBR= redis sentinel BIN_FILES= redis-benchmark redis-check-aof redis-check-dump \ redis-cli redis-sentinel redis-server diff --git a/databases/redis/files/sentinel.in b/databases/redis/files/sentinel.in new file mode 100644 index 000000000000..b66ae1492b01 --- /dev/null +++ b/databases/redis/files/sentinel.in @@ -0,0 +1,42 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: sentinel +# REQUIRE: LOGIN +# BEFORE: securelevel +# KEYWORD: shutdown + +# Add the following line to /etc/rc.conf to enable `sentinel': +# +#sentinel_enable="YES" +# + +. /etc/rc.subr + +name="sentinel" +rcvar="${name}_enable" + +command="/usr/local/bin/redis-sentinel" +pidfile="/var/run/redis/$name.pid" + +# read configuration and set defaults +load_rc_config "$name" +: ${sentinel_enable="NO"} +: ${sentinel_user="redis"} +: ${sentinel_config="/usr/local/etc/$name.conf"} + +command_args="${sentinel_config} --daemonize yes --pidfile ${pidfile}" +required_files="${sentinel_config}" +start_precmd="${name}_checks" +restart_precmd="${name}_checks" + +sentinel_checks() +{ + if [ x`id -u ${sentinel_user}` != x`stat -f %u ${sentinel_config}` ]; then + err 1 "${sentinel_config} must be owned by user ${sentinel_user}" + fi +} + +run_rc_command "$1" diff --git a/databases/redis/pkg-plist b/databases/redis/pkg-plist index adbb8f3a38b7..38dadc750ab7 100644 --- a/databases/redis/pkg-plist +++ b/databases/redis/pkg-plist @@ -6,7 +6,7 @@ bin/redis-sentinel bin/redis-server %%TRIB%%bin/redis-trib.rb @sample etc/redis.conf.sample -@sample etc/sentinel.conf.sample +@sample(%%REDIS_USER%%,%%REDIS_GROUP%%,) etc/sentinel.conf.sample @dir(%%REDIS_USER%%,%%REDIS_GROUP%%,) %%REDIS_DBDIR%% @dir(%%REDIS_USER%%,%%REDIS_GROUP%%,) %%REDIS_LOGDIR%% @dir(%%REDIS_USER%%,%%REDIS_GROUP%%,) %%REDIS_RUNDIR%% -- cgit v1.2.3