system/redis: Updated for version 2.6.5

Signed-off-by: dsomero <xgizzmo@slackbuilds.org>
This commit is contained in:
Audrius Kažukauskas 2012-12-02 12:35:22 -05:00 committed by dsomero
parent fd627f875c
commit 5a09ed3366
6 changed files with 137 additions and 15 deletions

View file

@ -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

61
system/redis/rc.redis.new Normal file
View file

@ -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

View file

@ -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 \

View file

@ -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=""

View file

@ -0,0 +1,9 @@
/var/log/redis.log {
daily
rotate 7
copytruncate
delaycompress
compress
notifempty
missingok
}

View file

@ -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------------------------------------------------------|