From 646b23bf2487d3682a70ec864123af0f793706d5 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 16 Oct 2013 05:19:32 +0000 Subject: [PATCH] redis: 2.6.16 --- redis/PKGBUILD | 54 +++++++++++++++++------------ redis/redis.d | 78 ------------------------------------------ redis/redis.install | 14 ++++++++ redis/redis.service | 3 +- redis/redis.tmpfiles.d | 1 + 5 files changed, 49 insertions(+), 101 deletions(-) delete mode 100644 redis/redis.d create mode 100644 redis/redis.install create mode 100644 redis/redis.tmpfiles.d diff --git a/redis/PKGBUILD b/redis/PKGBUILD index e2775a0ac..0553522fa 100644 --- a/redis/PKGBUILD +++ b/redis/PKGBUILD @@ -7,39 +7,49 @@ # Contributor: nofxx .com> pkgname=redis -pkgver=2.6.2 +pkgver=2.6.16 pkgrel=1 pkgdesc="Advanced key-value store" -arch=('i686' 'x86_64') +arch=('x86_64') url="http://redis.io/" license=('BSD') depends=('bash') makedepends=('gcc>=3.1' 'make' 'pkgconfig') backup=("etc/redis.conf" - "etc/logrotate.d/redis") -source=("http://redis.googlecode.com/files/${pkgname}-${pkgver}.tar.gz" - "redis.d" - "redis.service" - "redis.logrotate") -md5sums=('4f788dfb3ee86c7e864dfe537870bb5a' - '8d843919d9f165e9a47e56cadb4ac2ed' - '5ab9fdb200e15c13b450fda77fa030b6' - '9e2d75b7a9dc421122d673fe520ef17f') + "etc/logrotate.d/redis") +install=${pkgname}.install +source=("http://download.redis.io/releases/${pkgname}-${pkgver}.tar.gz" + "redis.service" + "redis.logrotate" + "redis.tmpfiles.d") +sha256sums=('81490918dcf82d124b36e48b0a9911bfba3f13abba04d8c89820324eff7df03a' + 'ca4d3cceeb39b4115d85516ab5a8eabd0b646b7a33ed718160ec335fe220261a' + 'afd12157eb5859c4e250faf0da7912559b7d43b152c589a69304bc5d43f3899a' + '7600554eb70af3c89e090fc768e7209a381b909bd941fcfc34c5e45a73f51948') + +prepare() { + cd ${pkgname}-${pkgver} + sed -i 's|# bind 127.0.0.1|bind 127.0.0.1|' redis.conf + sed -i 's|daemonize no|daemonize yes|' redis.conf + sed -i 's|dir \./|dir /var/lib/redis/|' redis.conf + sed -i 's|pidfile .*|pidfile /run/redis/redis.pid|' redis.conf + sed -i 's|logfile stdout|logfile /var/log/redis.log|' redis.conf +} build() { - cd "$srcdir/${pkgname}-${pkgver}" - make MALLOC=libc + cd ${pkgname}-${pkgver} + #make MALLOC=libc + make } package() { - cd "$srcdir/${pkgname}-${pkgver}" - mkdir -p $pkgdir/usr/bin - make INSTALL_BIN="$pkgdir/usr/bin" PREFIX=/usr install + cd ${pkgname}-${pkgver} + mkdir -p "${pkgdir}/usr/bin" + make INSTALL_BIN="${pkgdir}/usr/bin" PREFIX=/usr install - install -D -m755 "$srcdir/${pkgname}-${pkgver}/COPYING" "$pkgdir/usr/share/licenses/redis/COPYING" - install -D -m755 "$srcdir/redis.d" "$pkgdir/etc/rc.d/redis" - install -Dm644 "$srcdir"/redis.service "$pkgdir"/usr/lib/systemd/system/redis.service - install -Dm644 "$srcdir/redis.logrotate" "$pkgdir/etc/logrotate.d/redis" - sed -i 's|daemonize no|daemonize yes|;s|dir \./|dir /var/lib/redis/|;s|logfile stdout|logfile /var/log/redis.log| ' $srcdir/${pkgname}-${pkgver}/redis.conf - install -D -m644 "$srcdir/${pkgname}-${pkgver}/redis.conf" "$pkgdir/etc/redis.conf" + install -D -m755 COPYING "${pkgdir}/usr/share/licenses/redis/COPYING" + install -Dm644 "${srcdir}/redis.service" "${pkgdir}/usr/lib/systemd/system/redis.service" + install -Dm644 "${srcdir}/redis.logrotate" "${pkgdir}/etc/logrotate.d/redis" + install -D -m644 redis.conf "${pkgdir}/etc/redis.conf" + install -Dm644 "${srcdir}/redis.tmpfiles.d" "${pkgdir}/usr/lib/tmpfiles.d/redis.conf" } diff --git a/redis/redis.d b/redis/redis.d deleted file mode 100644 index e1c79dd2b..000000000 --- a/redis/redis.d +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/bash - -daemon_name=redis - -. /etc/rc.conf -. /etc/rc.d/functions - -REDISPORT=6379 -EXEC=/usr/bin/redis-server -CLIEXEC=/usr/bin/redis-cli -PIDFILE=/var/run/redis.pid -WORKDIR=/var/lib/redis -CONF="/etc/redis.conf" - -# Check if process exists -PID=$(cat $PIDFILE 2>/dev/null) -[ -d /proc/${PID} ] || rm -f $PIDFILE - -# Grab the server password, if exists -REDISPASS=`egrep -o '^requirepass ([^#]+)' $CONF | cut -d\ -f 2` -[ -n "$REDISPASS" ] && CLIEXEC="$CLIEXEC -a $REDISPASS" - -case "$1" in - start) - stat_busy "Starting $daemon_name" - [ -d $WORKDIR ] || mkdir $WORKDIR - - if [ -f $PIDFILE ]; then - stat_fail - exit 1 - else - $EXEC $CONF >/dev/null - if [ $? -gt 0 ]; then - stat_fail - exit 1 - else - add_daemon $daemon_name - stat_done - fi - fi - ;; - - stop) - stat_busy "Stopping $daemon_name" - - if [ ! -f $PIDFILE ]; then - stat_fail - exit 1 - else - PID=$(cat $PIDFILE) - - # And grab the server address - REDISADDR=`egrep -o '^bind ([^#]+)' $CONF | cut -d' ' -f2` - [ -n "$REDISADDR" ] && CLIEXEC="$CLIEXEC -h $REDISADDR" - - $CLIEXEC -p $REDISPORT shutdown - [ -d /proc/${PID} ] && sleep 1 - [ -d /proc/${PID} ] && sleep 5 - [ -d /proc/${PID} ] && kill -9 $PID - [ -d /proc/${PID} ] && stat_fail || { stat_done; rm_daemon $daemon_name; } - fi - ;; - - restart) - $0 stop - sleep 1 - $0 start - ;; - - status) - stat_busy "Checking $daemon_name status"; - ck_status $daemon_name - ;; - - *) - echo "usage: $0 {start|stop|restart|status}" -esac -exit 0 diff --git a/redis/redis.install b/redis/redis.install new file mode 100644 index 000000000..84fba69d4 --- /dev/null +++ b/redis/redis.install @@ -0,0 +1,14 @@ +post_install() { + grep -E "^redis:" etc/group >/dev/null || groupadd --system redis + grep -E "^redis:" etc/passwd >/dev/null || useradd --system -g redis -d /var/lib/redis -s /bin/false redis + touch var/log/redis.log + chown redis:redis var/log/redis.log + systemd-tmpfiles --create redis.conf + install -dm0700 var/lib/redis + chown -R redis:redis var/lib/redis +} + +post_upgrade() { + post_install + echo "Redis starts from redis user by default. Check redis.service file" +} diff --git a/redis/redis.service b/redis/redis.service index 7596b4bda..bb364f749 100644 --- a/redis/redis.service +++ b/redis/redis.service @@ -4,7 +4,8 @@ After=network.target [Service] Type=forking -PIDFile=/run/redis.pid +User=redis +PIDFile=/run/redis/redis.pid ExecStartPre=/bin/mkdir -p /var/lib/redis ExecStart=/usr/bin/redis-server /etc/redis.conf ExecStop=/usr/bin/redis-cli shutdown diff --git a/redis/redis.tmpfiles.d b/redis/redis.tmpfiles.d new file mode 100644 index 000000000..5e41240f7 --- /dev/null +++ b/redis/redis.tmpfiles.d @@ -0,0 +1 @@ +d /run/redis 0755 redis redis - \ No newline at end of file