aboutsummaryrefslogtreecommitdiffstats
path: root/main/redis
diff options
context:
space:
mode:
Diffstat (limited to 'main/redis')
-rw-r--r--main/redis/APKBUILD88
-rw-r--r--main/redis/redis-no-backtrace.patch11
-rw-r--r--main/redis/redis.confd9
-rwxr-xr-xmain/redis/redis.initd52
-rw-r--r--main/redis/redis.logrotate5
-rw-r--r--main/redis/redis.pre-install5
6 files changed, 170 insertions, 0 deletions
diff --git a/main/redis/APKBUILD b/main/redis/APKBUILD
new file mode 100644
index 0000000000..3cf4d66675
--- /dev/null
+++ b/main/redis/APKBUILD
@@ -0,0 +1,88 @@
+# Contributor: V.Krishn <vkrishn4@gmail.com>
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=redis
+pkgver=2.8.9
+pkgrel=1
+pkgdesc="Advanced key-value store"
+url="http://redis.io/"
+arch="all"
+license="BSD"
+depends=""
+depends_dev=""
+makedepends=""
+install="redis.pre-install"
+subpackages=""
+pkgusers="redis"
+pkggroups="redis"
+source="http://download.redis.io/releases/$pkgname-$pkgver.tar.gz
+ redis.initd
+ redis.logrotate
+ redis.confd
+ redis-no-backtrace.patch"
+
+_builddir="$srcdir"/$pkgname-$pkgver
+prepare() {
+ local i
+ cd "$_builddir"
+ for i in $source; do
+ case $i in
+ *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+ esac
+ done
+ sed -i -e 's|^daemonize .*|daemonize yes|' \
+ -e 's|^dir .*|dir /var/lib/redis/|' \
+ -e 's|^logfile .*|logfile /var/log/redis/redis\.log|' \
+ -e 's|^pidfile .*|pidfile /var/run/redis/redis\.pid|' \
+ -e 's|^loglevel .*|loglevel notice|' \
+ redis.conf || return 1
+}
+
+build() {
+ cd "$_builddir"
+ make PREFIX=/usr \
+ INSTALL_BIN="$pkgdir"/usr/bin \
+ MALLOC=libc \
+ all || return 1
+}
+
+package() {
+ cd "$_builddir"
+ mkdir -p "$pkgdir"/usr/bin
+ install -d -o redis -g redis \
+ "$pkgdir"/var/lib/redis \
+ "$pkgdir"/var/log/redis \
+ "$pkgdir"/var/run/redis \
+ || return 1
+
+ install -D -m755 "$_builddir/COPYING" \
+ "$pkgdir/usr/share/licenses/redis/COPYING" || return 1
+ install -D -m755 "$srcdir/redis.initd" "$pkgdir/etc/init.d/redis" \
+ && install -Dm644 "$srcdir/redis.logrotate" \
+ "$pkgdir/etc/logrotate.d/redis" \
+ && install -Dm644 "$srcdir/redis.confd" \
+ "$pkgdir/etc/conf.d/redis" \
+ || return 1
+ install -D -m644 "$_builddir/redis.conf" "$pkgdir/etc/redis.conf" \
+ || retrun 1
+
+ make PREFIX=/usr \
+ INSTALL_BIN="$pkgdir/usr/bin" \
+ install || return 1
+}
+
+
+md5sums="3c106b0f1128dc930684e2da88b2a03d redis-2.8.9.tar.gz
+6910862d7f07d5655c3d827a7fdddd6e redis.initd
+f49b80f4418f456dbf865a32443d4d1d redis.logrotate
+bf204d560e41b854297c60aff8d862d5 redis.confd
+b05226a52976efe40a23117d0b1fd9fa redis-no-backtrace.patch"
+sha256sums="7834c37f2ff186c46aef8e4a066dfbf1d6772a285aa31c19c58162f264f1007f redis-2.8.9.tar.gz
+573f75738c6e9526550334552a160b5e1fdb13fad0dbd859aaafdb2fa0f49310 redis.initd
+197d9b212eec3b8cd33878ba224f9a79b6f98a43c0663caf7e084c7969beb3f9 redis.logrotate
+97d50b2bee2df995317b505d459c31fe4abe74e670028f0335febdd6e4e31486 redis.confd
+595306f5ecd12530ef80914aef48020e2683cd6bb774aa167c3c3146c1b66907 redis-no-backtrace.patch"
+sha512sums="f202c44e16d257e33f7fabaa3b46218bf45848158a4b8c7cc2fab119fdf42bb4e19764a2f5f82fc8c76a3e353754b6b25f2cacf20a253d28244acbf87fd6dd7a redis-2.8.9.tar.gz
+35f10b9cfcc19ebcffb418d031bdc5bcf613d5e12d601c04ad1475b0e805950cb3a2304ba6137432b0a1d9bbc788aa2d8246d036f9f96f3b9c1f7a76ffaad845 redis.initd
+706cfedb7fb320649c7ad02845d7477b85ce1e5d9dced39b938c6f754e6e9eb666e22f6eddc4cbffa3f63a1f6fb6f3221244e5bcd8fa92706c256aa1fe50ff41 redis.logrotate
+d87aad6185300c99cc9b6a478c83bf62c450fb2c225592d74cc43a3adb93e19d8d2a42cc279907b385aa73a7b9c77b66828dbfb001009edc16a604abb2087e99 redis.confd
+c2ff78d0c161ef63661e09d860887d35c74049a2ae3bd00ced755fb848dfe2ae60b1f0a2b435f5c028638db5502de1475f8355bb097d8180a4d2c76def36a1cc redis-no-backtrace.patch"
diff --git a/main/redis/redis-no-backtrace.patch b/main/redis/redis-no-backtrace.patch
new file mode 100644
index 0000000000..809e924f20
--- /dev/null
+++ b/main/redis/redis-no-backtrace.patch
@@ -0,0 +1,11 @@
+--- a/src/config.h
++++ b/src/config.h
+@@ -54,7 +54,7 @@
+ #endif
+
+ /* Test for backtrace() */
+-#if defined(__APPLE__) || defined(__linux__)
++#if defined(__APPLE__) || (defined(__linux__) && defined(__GLIBC__))
+ #define HAVE_BACKTRACE 1
+ #endif
+
diff --git a/main/redis/redis.confd b/main/redis/redis.confd
new file mode 100644
index 0000000000..a79f61ccdb
--- /dev/null
+++ b/main/redis/redis.confd
@@ -0,0 +1,9 @@
+# Redis user.
+REDIS_USER="redis"
+
+# Redis group.
+REDIS_GROUP="redis"
+
+# Redis configuration file.
+REDIS_CONF="/etc/redis.conf"
+
diff --git a/main/redis/redis.initd b/main/redis/redis.initd
new file mode 100755
index 0000000000..f6c2ce617a
--- /dev/null
+++ b/main/redis/redis.initd
@@ -0,0 +1,52 @@
+#!/sbin/runscript
+
+REDIS_CONF=${REDIS_CONF:-/etc/redis.conf}
+REDIS_USER=${REDIS_USER:-redis}
+REDIS_GROUP=${REDIS_GROUP:-redis}
+
+name="Redis server"
+command=/usr/bin/redis-server
+command_args=${REDIS_CONF}
+
+depend() {
+ use net localmount logger
+ after keepalived firewall
+}
+
+# get global pidfile, logfile, and dir from config file
+get_config() {
+ if [ ! -f "${REDIS_CONF}" ] ; then
+ eerror "You need a ${REDIS_CONF} file to run redis"
+ return 1;
+ fi
+
+ pidfile=$(awk '$1 == "pidfile" { print $2 }' "$REDIS_CONF")
+ logfile=$(awk '$1 == "logfile" { print $2 }' "$REDIS_CONF")
+ dir=$(awk '$1 == "dir" { print $2 }' "$REDIS_CONF")
+ : ${pidfile:=/var/run/redis/redis.pid}
+ : ${logfile:=/var/log/redis/redis.log}
+ : ${dir:=/var/lib/redis}
+}
+
+start() {
+ get_config || return 1
+ checkpath -d -o ${REDIS_USER}:${REDIS_GROUP} ${pidfile%/*} \
+ ${logfile%/*} ${dir}
+
+ ebegin "Starting $name"
+ start-stop-daemon --start \
+ --chdir "${dir}" \
+ --user ${REDIS_USER}:${REDIS_GROUP} \
+ --pidfile "${pidfile}" \
+ --exec "${command}" \
+ -- ${command_args}
+ eend $?
+}
+
+stop() {
+ get_config
+ ebegin "Stopping $name"
+ start-stop-daemon --stop --retry 30 --pidfile "${pidfile}"
+ eend $?
+}
+
diff --git a/main/redis/redis.logrotate b/main/redis/redis.logrotate
new file mode 100644
index 0000000000..aa5f6a2547
--- /dev/null
+++ b/main/redis/redis.logrotate
@@ -0,0 +1,5 @@
+/var/log/redis/redis.log {
+ notifempty
+ copytruncate
+ missingok
+}
diff --git a/main/redis/redis.pre-install b/main/redis/redis.pre-install
new file mode 100644
index 0000000000..2e36f49e07
--- /dev/null
+++ b/main/redis/redis.pre-install
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+addgroup redis 2>/dev/null
+adduser -S -H -h /var/lib/redis -s /bin/false -D -G redis redis 2>/dev/null
+exit 0