#!/bin/bash # # redis.SlackBuild is free software; you can redistribute it and/or modify it under the # terms of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or any later version. # # redis.SlackBuild is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., 59 Temple # Place - Suite 330, Boston, MA 02111-1307, USA # # default settings PACKAGE="redis" PACKAGE_EXT="gz" VERSION=${VERSION:=6.2.6} BUILD=${BUILD:=1} if [ -f ~/.slackbuildrc ]; then . ~/.slackbuildrc elif [ -f ../../runtime/slackbuildrc ]; then . ../../runtime/slackbuildrc fi check_required SRC="$PACKAGE-$VERSION.tar.$PACKAGE_EXT" URL="http://download.redis.io/releases/$SRC" get_source $SRC $URL unpack_source $SRC $PACKAGE-$VERSION # Use our flags (thanks to SBo) sed "s|-O3||" -i deps/Makefile -i deps/hiredis/Makefile make CFLAGS="$SLKCFLAGS" make PREFIX=$PKG/usr install # Create symlink to start redis in sentinel mode. ( cd $PKG/usr/bin ; ln -sf redis-server redis-sentinel ) # Use sample config and set some sane defaults. mkdir -p $PKG/etc/redis sed -e 's|^daemonize no|daemonize yes|' \ -e 's|^dir \.|dir /var/lib/redis|' \ -e 's|^logfile ""|logfile /var/log/redis/redis.log|' \ -e 's|^# bind 127.0.0.1|bind 127.0.0.1|' \ -e 's|^tcp-keepalive 0|tcp-keepalive 60|' \ -e 's|^# unixsocket|unixsocket|' \ redis.conf > $PKG/etc/redis/redis.conf.new install -Dm0644 sentinel.conf $PKG/etc/redis/sentinel.conf.new # Create data directory. install -dm0700 $PKG/var/lib/redis # Install init script. install -Dm755 $CWD/files/rc.redis $PKG/etc/rc.d/init.d/redis # Install setup script install -Dm755 $CWD/files/setup.redis $PKG/var/lib/pkgtools/setup/setup.redis # Install logrotate script. install -Dm644 $CWD/files/redis.logrotate $PKG/etc/logrotate.d/redis.new mkdir -p $PKG/var/log/redis mkdir -p $DOCS cp -a 00-RELEASENOTES BUGS CONTRIBUTING COPYING MANIFESTO README $DOCS || true fixup_package $PKG set +u # Clean up the extra stuff: if [ "$1" = "--cleanup" ]; then rm -rf $TMP/$PACKAGE-$VERSION rm -rf $PKG fi