Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

Commit

Permalink
Merge pull request #66 from derdanne/gentoo-support
Browse files Browse the repository at this point in the history
add Gentoo support
  • Loading branch information
dwerder committed Jan 19, 2016
2 parents ec3513b + 0188cc2 commit e47fc28
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 1 deletion.
3 changes: 3 additions & 0 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@
}
}
}
'Gentoo': {
package { 'dev-db/redis' : ensure => $redis_version, }
}
default: {
fail('The module does not support this OS.')
}
Expand Down
3 changes: 2 additions & 1 deletion manifests/sentinel.pp
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,12 @@
validate_bool($running)
validate_bool($enabled)
validate_bool($manage_logrotate)

$redis_install_dir = $::redis::install::redis_install_dir
$sentinel_init_script = $::operatingsystem ? {
/(Debian|Ubuntu)/ => 'redis/etc/init.d/debian_redis-sentinel.erb',
/(Fedora|RedHat|CentOS|OEL|OracleLinux|Amazon|Scientific)/ => 'redis/etc/init.d/redhat_redis-sentinel.erb',
/(Gentoo)/ => 'redis/etc/init.d/gentoo_redis-sentinel.erb',
default => UNDEF,
}

Expand Down
1 change: 1 addition & 0 deletions manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
/(Debian|Ubuntu)/ => 'redis/etc/init.d/debian_redis-server.erb',
/(Fedora|RedHat|CentOS|OEL|OracleLinux|Amazon|Scientific)/ => 'redis/etc/init.d/redhat_redis-server.erb',
/(SLES)/ => 'redis/etc/init.d/sles_redis-server.erb',
/(Gentoo)/ => 'redis/etc/init.d/gentoo_redis-server.erb',
default => UNDEF,
}
$redis_2_6_or_greater = versioncmp($::redis::install::redis_version,'2.6') >= 0
Expand Down
34 changes: 34 additions & 0 deletions templates/etc/init.d/gentoo_redis-sentinel.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/sbin/runscript
# $Id$

SENTINEL_DIR="/var/lib/redis"
SENTINEL_CONF="/etc/redis-sentinel_<%= @sentinel_name %>.conf"
SENTINEL_USER="root"
SENTINEL_GROUP="root"
SENTINEL_TIMEOUT=30
SENTINEL_PID="<%= @sentinel_pid_dir %>/redis-sentinel_<%= @sentinel_name %>.pid"

command="<%= @redis_install_dir %>/redis-server"
pidfile="${SENTINEL_PID}"

start_stop_daemon_args="--background --pidfile ${SENTINEL_PID}
--chdir \"${SENTINEL_DIR}\" --user ${SENTINEL_USER} --group ${SENTINEL_GROUP}"
command_args="${SENTINEL_CONF} --sentinel"

depend() {
use net localmount logger
after keepalived
}

start_pre() {
checkpath -d -m 0775 -o ${SENTINEL_USER}:${SENTINEL_GROUP} $(dirname ${SENTINEL_PID})
}

stop() {
ebegin "Stopping ${SVCNAME}"
start-stop-daemon --stop \
--exec ${command} \
--retry ${SENTINEL_TIMEOUT} \
--pidfile ${SENTINEL_PID}
eend
}
34 changes: 34 additions & 0 deletions templates/etc/init.d/gentoo_redis-server.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/sbin/runscript
# $Id$

REDIS_DIR="<%= @redis_dir %>/redis_<%= @redis_name %>"
REDIS_CONF="/etc/redis_<%= @redis_name %>.conf"
REDIS_USER=<%= @redis_user %>
REDIS_GROUP=<%= @redis_group %>
REDIS_TIMEOUT=30
REDIS_PID="<%= @redis_pid_dir %>/redis_<%= @redis_name %>.pid"

command="<%= @redis_install_dir %>/redis-server"
pidfile="${REDIS_PID}"

start_stop_daemon_args="--background --pidfile ${REDIS_PID}
--chdir \"${REDIS_DIR}\" --user ${REDIS_USER} --group ${REDIS_GROUP}"
command_args="${REDIS_CONF}"

depend() {
use net localmount logger
after keepalived
}

start_pre() {
checkpath -d -m 0775 -o ${REDIS_USER}:${REDIS_GROUP} $(dirname ${REDIS_PID})
}

stop() {
ebegin "Stopping ${SVCNAME}"
start-stop-daemon --stop \
--exec ${command} \
--retry ${REDIS_TIMEOUT} \
--pidfile ${REDIS_PID}
eend
}

0 comments on commit e47fc28

Please sign in to comment.