diff options
Diffstat (limited to 'system/redis')
-rw-r--r-- | system/redis/doinst.sh | 15 | ||||
-rw-r--r-- | system/redis/rc.redis.new | 61 | ||||
-rw-r--r-- | system/redis/redis.SlackBuild | 53 | ||||
-rw-r--r-- | system/redis/redis.info | 6 | ||||
-rw-r--r-- | system/redis/redis.logrotate | 9 | ||||
-rw-r--r-- | system/redis/slack-desc | 8 |
6 files changed, 137 insertions, 15 deletions
diff --git a/system/redis/doinst.sh b/system/redis/doinst.sh index de6501f387f7c..723cedbc2cca4 100644 --- a/system/redis/doinst.sh +++ b/system/redis/doinst.sh @@ -10,5 +10,18 @@ config() { fi # Otherwise, we leave the .new copy for the admin to consider... } -config etc/redis.conf.new +preserve_perms() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + if [ -e $OLD ]; then + cp -a $OLD ${NEW}.incoming + cat $NEW > ${NEW}.incoming + mv ${NEW}.incoming $NEW + fi + config $NEW +} + +config etc/redis.conf.new +config etc/logrotate.d/redis.new +preserve_perms etc/rc.d/rc.redis.new diff --git a/system/redis/rc.redis.new b/system/redis/rc.redis.new new file mode 100644 index 0000000000000..f20fde7673ccf --- /dev/null +++ b/system/redis/rc.redis.new @@ -0,0 +1,61 @@ +#!/bin/sh +# +# Redis startup script for Slackware Linux + +PORT=6379 +SERV=/usr/bin/redis-server +CLI=/usr/bin/redis-cli +PIDFILE=/var/run/redis.pid +CONF=/etc/redis.conf + +redis_start() { + if [ ! -r $CONF ]; then + echo "$CONF does not appear to exist. Abort." + exit 1 + fi + + if [ -s $PIDFILE ]; then + echo "Redis appears to be already running?" + exit 1 + fi + + echo "Starting Redis server..." + $SERV $CONF +} + +redis_stop() { + if [ ! -s $PIDFILE ]; then + echo "$PIDFILE does not exist or is empty." + exit 1 + fi + + PID=$(cat $PIDFILE) + echo -n "Stopping Redis server..." + $CLI -p $PORT shutdown + while [ -d /proc/$PID ]; do + sleep 1 + echo -n "." + done + echo " done" +} + +redis_restart() { + redis_stop + sleep 3 + redis_start +} + +case "$1" in + start) + redis_start + ;; + stop) + redis_stop + ;; + restart) + redis_restart + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 +esac diff --git a/system/redis/redis.SlackBuild b/system/redis/redis.SlackBuild index a40cbfc35b727..bd4c9292d0785 100644 --- a/system/redis/redis.SlackBuild +++ b/system/redis/redis.SlackBuild @@ -1,11 +1,30 @@ #!/bin/sh # Slackware build script for redis -# Originally written by kuroi_kenshi <kuroi_kenshi96@yahoo.com> -# Maintained as of version 2.4.7 by Audrius Kažukauskas <audrius@neutrino.lt> + +# Copyright 2010 Kuroi Kenshi <kuroi_kenshi96@yahoo.com> +# Copyright 2012 Audrius Kažukauskas <audrius@neutrino.lt> +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. PRGNAM=redis -VERSION=${VERSION:-2.4.14} +VERSION=${VERSION:-2.6.5} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} @@ -52,14 +71,34 @@ CFLAGS="$SLKCFLAGS" make # Install binaries. mkdir -p $PKG/usr/bin -install -m 0755 src/redis-{server,cli,benchmark,check-aof,check-dump} \ - $PKG/usr/bin +install -m 0755 src/redis-{server,cli,benchmark,check-{aof,dump}} $PKG/usr/bin + +# Create symlink to start redis in sentinel mode. +( cd $PKG/usr/bin ; ln -sf redis-server redis-sentinel ) find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true -# Use sample config, without overwriting. -install -D -m 644 redis.conf $PKG/etc/redis.conf.new +# Use sample config and set some sane defaults. +install -D -m 0644 redis.conf $PKG/etc/redis.conf.new +sed -i \ + -e 's|^daemonize no|daemonize yes|' \ + -e 's|^dir \.|dir /var/lib/redis|' \ + -e 's|^logfile stdout|logfile /var/log/redis.log|' \ + -e 's|^# bind 127.0.0.1|bind 127.0.0.1|' \ + $PKG/etc/redis.conf.new + +# Create data directory. +mkdir -p $PKG/var/lib/redis +chmod 0700 $PKG/var/lib/redis + +# Install init script. +mkdir -p $PKG/etc/rc.d +cat $CWD/rc.redis.new > $PKG/etc/rc.d/rc.redis.new + +# Install logrotate script. +mkdir -p $PKG/etc/logrotate.d +cat $CWD/redis.logrotate > $PKG/etc/logrotate.d/redis.new mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION cp -a \ diff --git a/system/redis/redis.info b/system/redis/redis.info index 0b0c7a757ab90..7b93cd2e68a1d 100644 --- a/system/redis/redis.info +++ b/system/redis/redis.info @@ -1,8 +1,8 @@ PRGNAM="redis" -VERSION="2.4.14" +VERSION="2.6.5" HOMEPAGE="http://redis.io/" -DOWNLOAD="http://redis.googlecode.com/files/redis-2.4.14.tar.gz" -MD5SUM="1bc8f833b955ef119d643da08084433f" +DOWNLOAD="http://redis.googlecode.com/files/redis-2.6.5.tar.gz" +MD5SUM="ce52e1716ca215f38e88fd861e951e3e" DOWNLOAD_x86_64="" MD5SUM_x86_64="" REQUIRES="" diff --git a/system/redis/redis.logrotate b/system/redis/redis.logrotate new file mode 100644 index 0000000000000..2f3e6d6c1adaa --- /dev/null +++ b/system/redis/redis.logrotate @@ -0,0 +1,9 @@ +/var/log/redis.log { + daily + rotate 7 + copytruncate + delaycompress + compress + notifempty + missingok +} diff --git a/system/redis/slack-desc b/system/redis/slack-desc index d9142c8494cf6..0524cec54874c 100644 --- a/system/redis/slack-desc +++ b/system/redis/slack-desc @@ -1,8 +1,8 @@ # HOW TO EDIT THIS FILE: -# The "handy ruler" below makes it easier to edit a package description. Line -# up the first '|' above the ':' following the base package name, and the '|' -# on the right side marks the last column you can put a character in. You must -# make exactly 11 lines for the formatting to be correct. It's also +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also # customary to leave one space after the ':' except on otherwise blank lines. |-----handy-ruler------------------------------------------------------| |