summaryrefslogtreecommitdiff
path: root/user/redis
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2018-06-08 02:11:51 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2018-06-08 02:11:51 -0500
commitc86aec496298fb20f0770f5ce9a2a37935f7aa5b (patch)
treeb95d17ae82ab73a2a147a2f0c9734c309e5f9807 /user/redis
parentfd2bb2f751c13b3c0c002b8e012810902b9da364 (diff)
downloadpackages-c86aec496298fb20f0770f5ce9a2a37935f7aa5b.tar.gz
packages-c86aec496298fb20f0770f5ce9a2a37935f7aa5b.tar.bz2
packages-c86aec496298fb20f0770f5ce9a2a37935f7aa5b.tar.xz
packages-c86aec496298fb20f0770f5ce9a2a37935f7aa5b.zip
put user stuff in user, not system
Diffstat (limited to 'user/redis')
-rw-r--r--user/redis/APKBUILD87
-rw-r--r--user/redis/fix-ppc-atomics.patch13
-rw-r--r--user/redis/posix-runtest.patch33
-rw-r--r--user/redis/redis.confd9
-rwxr-xr-xuser/redis/redis.initd52
-rw-r--r--user/redis/redis.logrotate4
-rw-r--r--user/redis/redis.pre-install6
7 files changed, 204 insertions, 0 deletions
diff --git a/user/redis/APKBUILD b/user/redis/APKBUILD
new file mode 100644
index 000000000..fc8ea8426
--- /dev/null
+++ b/user/redis/APKBUILD
@@ -0,0 +1,87 @@
+# Contributor: V.Krishn <vkrishn4@gmail.com>
+# Maintainer:
+pkgname=redis
+pkgver=4.0.2
+pkgrel=2
+pkgdesc="Advanced key-value store"
+url="http://redis.io/"
+arch="all"
+license="BSD"
+depends=""
+makedepends="linux-headers"
+checkdepends="tcl"
+splitpackages="$pkgname-openrc"
+install="redis.pre-install"
+pkgusers="redis"
+pkggroups="redis"
+source="http://download.redis.io/releases/$pkgname-$pkgver.tar.gz
+ fix-ppc-atomics.patch
+ posix-runtest.patch
+ redis.initd
+ redis.logrotate
+ redis.confd
+ "
+builddir="$srcdir/$pkgname-$pkgver"
+
+prepare() {
+ default_prepare
+
+ cd "$builddir"
+ 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
+
+ # disable broken tests
+ # see: https://github.com/antirez/redis/issues/2814
+ # https://github.com/antirez/redis/issues/3810
+
+ sed -i -e '/integration\/aof/d' \
+ -e '/integration\/logging/d' \
+ tests/test_helper.tcl
+}
+
+build() {
+ cd "$builddir"
+ make PREFIX=/usr \
+ INSTALL_BIN="$pkgdir"/usr/bin \
+ MALLOC=libc \
+ FINAL_LIBS="-latomic " \
+ all
+}
+
+check() {
+ cd "$builddir"
+ make test
+}
+
+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
+
+ install -D -m755 "$builddir/COPYING" \
+ "$pkgdir/usr/share/licenses/redis/COPYING"
+ 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"
+ install -D -m644 "$builddir/redis.conf" "$pkgdir/etc/redis.conf"
+
+ make PREFIX=/usr \
+ INSTALL_BIN="$pkgdir/usr/bin" \
+ install
+}
+
+sha512sums="1458909c6fc16cff8ca5e6dddff23b988ee1e447f2d0bccf5941553b22bab6abb851732b3fe53dafb8a69d6c0939c3ce7e0686d51e03be720fb018c038d3b1b4 redis-4.0.2.tar.gz
+f768acea3e1868dbf0596085640c83e58d899860d7d647b0965fa858844c494d0a49b229fb417456d83f3e2690e5450950c31e0fa40529df85a9cde38d8981c4 fix-ppc-atomics.patch
+856ae98e9e8670801827c3bd793dc14ed2c62c37365f8d04b452d7e1ab97300a0bf18c59b52ea686c2689d53aeed8e29e2c55207d3d4fb1fd8fc7fc820f33157 posix-runtest.patch
+91b663f802aea9a473195940d3bf2ce3ca2af4e5b6e61a2d28ebbfe502ef2c764b574b7e87c49e60345d1a5d6b73d12920924c93b26be110c2ce824023347b6f redis.initd
+6d17d169b40a7e23a0a2894eff0f3e2fe8e4461b36f2a9d45468f0abd84ea1035d679b4c0a34029bce093147f9c7bb697e843c113c17769d38c934d4a78a5848 redis.logrotate
+d87aad6185300c99cc9b6a478c83bf62c450fb2c225592d74cc43a3adb93e19d8d2a42cc279907b385aa73a7b9c77b66828dbfb001009edc16a604abb2087e99 redis.confd"
diff --git a/user/redis/fix-ppc-atomics.patch b/user/redis/fix-ppc-atomics.patch
new file mode 100644
index 000000000..0263bb531
--- /dev/null
+++ b/user/redis/fix-ppc-atomics.patch
@@ -0,0 +1,13 @@
+--- redis-4.0.2/src/Makefile.old 2017-09-21 09:12:52.000000000 -0500
++++ redis-4.0.2/src/Makefile 2018-05-26 18:45:23.494413590 -0500
+@@ -109,6 +109,10 @@
+ # Include paths to dependencies
+ FINAL_CFLAGS+= -I../deps/hiredis -I../deps/linenoise -I../deps/lua/src
+
++ifeq ($(uname_M),ppc)
++ FINAL_LIBS+= -latomic
++endif
++
+ ifeq ($(MALLOC),tcmalloc)
+ FINAL_CFLAGS+= -DUSE_TCMALLOC
+ FINAL_LIBS+= -ltcmalloc
diff --git a/user/redis/posix-runtest.patch b/user/redis/posix-runtest.patch
new file mode 100644
index 000000000..84d76ad10
--- /dev/null
+++ b/user/redis/posix-runtest.patch
@@ -0,0 +1,33 @@
+--- redis-4.0.2/runtest.old 2017-09-21 09:12:52.000000000 -0500
++++ redis-4.0.2/runtest 2017-12-31 05:50:13.037119127 -0600
+@@ -3,7 +3,7 @@
+ TCLSH=""
+
+ for VERSION in $TCL_VERSIONS; do
+- TCL=`which tclsh$VERSION 2>/dev/null` && TCLSH=$TCL
++ TCL=`command -v tclsh$VERSION 2>/dev/null` && TCLSH=$TCL
+ done
+
+ if [ -z $TCLSH ]
+--- redis-4.0.2/runtest-cluster.old 2017-09-21 09:12:52.000000000 -0500
++++ redis-4.0.2/runtest-cluster 2017-12-31 05:50:20.517111722 -0600
+@@ -3,7 +3,7 @@
+ TCLSH=""
+
+ for VERSION in $TCL_VERSIONS; do
+- TCL=`which tclsh$VERSION 2>/dev/null` && TCLSH=$TCL
++ TCL=`command -v tclsh$VERSION 2>/dev/null` && TCLSH=$TCL
+ done
+
+ if [ -z $TCLSH ]
+--- redis-4.0.2/runtest-sentinel.old 2017-09-21 09:12:52.000000000 -0500
++++ redis-4.0.2/runtest-sentinel 2017-12-31 05:50:26.877105425 -0600
+@@ -3,7 +3,7 @@
+ TCLSH=""
+
+ for VERSION in $TCL_VERSIONS; do
+- TCL=`which tclsh$VERSION 2>/dev/null` && TCLSH=$TCL
++ TCL=`command -v tclsh$VERSION 2>/dev/null` && TCLSH=$TCL
+ done
+
+ if [ -z $TCLSH ]
diff --git a/user/redis/redis.confd b/user/redis/redis.confd
new file mode 100644
index 000000000..a79f61ccd
--- /dev/null
+++ b/user/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/user/redis/redis.initd b/user/redis/redis.initd
new file mode 100755
index 000000000..ce6aba7e3
--- /dev/null
+++ b/user/redis/redis.initd
@@ -0,0 +1,52 @@
+#!/sbin/openrc-run
+
+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/user/redis/redis.logrotate b/user/redis/redis.logrotate
new file mode 100644
index 000000000..c77c9a0e8
--- /dev/null
+++ b/user/redis/redis.logrotate
@@ -0,0 +1,4 @@
+/var/log/redis/redis.log {
+ notifempty
+ missingok
+}
diff --git a/user/redis/redis.pre-install b/user/redis/redis.pre-install
new file mode 100644
index 000000000..f73213126
--- /dev/null
+++ b/user/redis/redis.pre-install
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+addgroup -S redis 2>/dev/null
+adduser -S -D -H -h /var/lib/redis -s /bin/false -G redis -g redis redis 2>/dev/null
+
+exit 0