summaryrefslogtreecommitdiffstats
path: root/testing/redis
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2012-06-04 12:49:51 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2012-06-04 12:52:59 +0000
commit728a7325eb258309ecc3213e5b7ec873cbe2e937 (patch)
tree7f1ebf2e7f90fbcd7de45b4736cc49579f0ae321 /testing/redis
parenta121333ef7dfcfe2a27fc85d787e26aae1c63df6 (diff)
downloadaports-728a7325eb258309ecc3213e5b7ec873cbe2e937.tar.bz2
aports-728a7325eb258309ecc3213e5b7ec873cbe2e937.tar.xz
testing/redis: various fixes
- avoid building linenoise at install time - set loglevel to 'notice' by default - set default log and pidfiles in redis subdir with permissions - create redis user at pre-install - fix init.d script to read pid, log and dir from redis.conf - remove unnneded vars from conf.d
Diffstat (limited to 'testing/redis')
-rw-r--r--testing/redis/APKBUILD34
-rw-r--r--testing/redis/redis.confd11
-rwxr-xr-x[-rw-r--r--]testing/redis/redis.initd57
-rw-r--r--testing/redis/redis.pre-install5
4 files changed, 62 insertions, 45 deletions
diff --git a/testing/redis/APKBUILD b/testing/redis/APKBUILD
index 6321569a5..e0e0e908c 100644
--- a/testing/redis/APKBUILD
+++ b/testing/redis/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=redis
pkgver=2.4.14
-pkgrel=0
+pkgrel=1
pkgdesc="Advanced key-value store"
url="http://redis.googlecode.com"
arch="all"
@@ -10,7 +10,7 @@ license="BSD"
depends=""
depends_dev=""
makedepends=""
-install=""
+install="redis.pre-install"
subpackages=""
pkgusers="redis"
pkggroups="redis"
@@ -22,18 +22,31 @@ source="http://redis.googlecode.com/files/$pkgname-$pkgver.tar.gz
_builddir="$srcdir"/$pkgname-$pkgver
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 || return 1
}
build() {
cd "$_builddir"
export CFLAGS="$CFLAGS -std=c99"
- make PREFIX=/usr INSTALL_BIN="$pkgdir"/usr/bin \
- FORCE_LIBC_MALLOC=yes || return 1
+ make PREFIX=/usr \
+ INSTALL_BIN="$pkgdir"/usr/bin \
+ FORCE_LIBC_MALLOC=yes \
+ 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
@@ -43,18 +56,17 @@ package() {
&& install -Dm644 "$srcdir/redis.confd" \
"$pkgdir/etc/conf.d/redis" \
|| return 1
- sed -i -e 's|daemonize no|daemonize yes|' \
- -e 's|dir \./|dir /var/lib/redis/|' \
- -e 's|logfile stdout|logfile /var/log/redis.log|' \
- $_builddir/redis.conf || return 1
install -D -m644 "$_builddir/redis.conf" "$pkgdir/etc/redis.conf" \
|| retrun 1
- make INSTALL_BIN="$pkgdir/usr/bin" PREFIX=/usr install || return 1
+ make PREFIX=/usr \
+ INSTALL_BIN="$pkgdir/usr/bin" \
+ FORCE_LIBC_MALLOC=yes \
+ install || return 1
}
md5sums="1bc8f833b955ef119d643da08084433f redis-2.4.14.tar.gz
-9aee4f445f4f6fcbc4475691f12e62af redis.initd
+7fb0daf8dcfcda6fd6291dc0291ce579 redis.initd
9e2d75b7a9dc421122d673fe520ef17f redis.logrotate
-91c1be756ef41ab3a47a3573100bb335 redis.confd"
+bf204d560e41b854297c60aff8d862d5 redis.confd"
diff --git a/testing/redis/redis.confd b/testing/redis/redis.confd
index 3ee35cbb9..a79f61ccd 100644
--- a/testing/redis/redis.confd
+++ b/testing/redis/redis.confd
@@ -7,14 +7,3 @@ REDIS_GROUP="redis"
# Redis configuration file.
REDIS_CONF="/etc/redis.conf"
-# Redis dump directory.
-REDIS_DIR="/var/lib/redis"
-
-# Redis pid file.
-# (Be sure to change the main redis configuration file as well if you change
-# this from the default.)
-REDIS_PID="/var/run/redis.pid"
-
-# Redis options.
-# (Redis expects the first argument to be the configuration file.)
-REDIS_OPTS="${REDIS_CONF}"
diff --git a/testing/redis/redis.initd b/testing/redis/redis.initd
index a23bcc774..3c4b7901c 100644..100755
--- a/testing/redis/redis.initd
+++ b/testing/redis/redis.initd
@@ -1,42 +1,53 @@
#!/sbin/runscript
-REDIS_EXEC=/usr/bin/redis-server
-REDIS_PID=${REDIS_PID:-/var/run/redis.pid}
-REDIS_DIR=${REDIS_DIR:-/var/lib/redis}
REDIS_CONF=${REDIS_CONF:-/etc/redis.conf}
-REDIS_OPTS=${REDIS_OPTS:-"${REDIS_CONF}"}
REDIS_USER=${REDIS_USER:-redis}
REDIS_GROUP=${REDIS_GROUP:-redis}
-REDIS_PORT=${REDIS_PORT:-6379}
-REDIS_CLIEXEC=/usr/bin/redis-cli
+
+name="Redis server"
+command=/usr/bin/redis-server
+command_args=${REDIS_CONF}
depend() {
use net localmount logger
after keepalived firewall
}
-start() {
+# 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}
+}
- local PID_DIR=$(dirname ${REDIS_PID})
- checkpath -d -o ${REDIS_USER}:${REDIS_GROUP} ${PID_DIR}
+start() {
+ get_config || return 1
+ checkpath -d -o ${REDIS_USER}:${REDIS_GROUP} ${pidfile%/*} \
+ ${logfile%/*} ${dir}
- ebegin "Starting Redis server"
+ ebegin "Starting $name"
start-stop-daemon --start \
- --chdir "${REDIS_DIR}" \
+ --chdir "${dir}" \
--user ${REDIS_USER}:${REDIS_GROUP} \
- --pidfile "${REDIS_PID}" \
- --exec "${REDIS_EXEC}" \
- -- ${REDIS_OPTS}
- ret=$?
- eend ${ret}
-
+ --pidfile "${pidfile}" \
+ --exec "${command}" \
+ -- ${command_args}
+ eend $?
}
-stop() {
- ebegin "Stopping Redis server"
- start-stop-daemon --stop --quiet --pidfile "${REDIS_PID}"
- ret=$?
- rm -f "${REDIS_PID}"
- eend ${ret}
+stop_post() {
+ get_config
+ ebegin "Stopping $name"
+ start-stop-daemon --stop --quiet --pidfile "${pidfile}" \
+ && rm -f "${pidfile}"
+ eend $?
}
diff --git a/testing/redis/redis.pre-install b/testing/redis/redis.pre-install
new file mode 100644
index 000000000..2e36f49e0
--- /dev/null
+++ b/testing/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