mirror of
https://gitdl.cn/https://github.com/chakralinux/desktop.git
synced 2025-01-24 02:22:13 +08:00
redis: 2.6.16
This commit is contained in:
parent
9f3b319bb9
commit
646b23bf24
@ -7,39 +7,49 @@
|
|||||||
# Contributor: nofxx <x@<nick>.com>
|
# Contributor: nofxx <x@<nick>.com>
|
||||||
|
|
||||||
pkgname=redis
|
pkgname=redis
|
||||||
pkgver=2.6.2
|
pkgver=2.6.16
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="Advanced key-value store"
|
pkgdesc="Advanced key-value store"
|
||||||
arch=('i686' 'x86_64')
|
arch=('x86_64')
|
||||||
url="http://redis.io/"
|
url="http://redis.io/"
|
||||||
license=('BSD')
|
license=('BSD')
|
||||||
depends=('bash')
|
depends=('bash')
|
||||||
makedepends=('gcc>=3.1' 'make' 'pkgconfig')
|
makedepends=('gcc>=3.1' 'make' 'pkgconfig')
|
||||||
backup=("etc/redis.conf"
|
backup=("etc/redis.conf"
|
||||||
"etc/logrotate.d/redis")
|
"etc/logrotate.d/redis")
|
||||||
source=("http://redis.googlecode.com/files/${pkgname}-${pkgver}.tar.gz"
|
install=${pkgname}.install
|
||||||
"redis.d"
|
source=("http://download.redis.io/releases/${pkgname}-${pkgver}.tar.gz"
|
||||||
"redis.service"
|
"redis.service"
|
||||||
"redis.logrotate")
|
"redis.logrotate"
|
||||||
md5sums=('4f788dfb3ee86c7e864dfe537870bb5a'
|
"redis.tmpfiles.d")
|
||||||
'8d843919d9f165e9a47e56cadb4ac2ed'
|
sha256sums=('81490918dcf82d124b36e48b0a9911bfba3f13abba04d8c89820324eff7df03a'
|
||||||
'5ab9fdb200e15c13b450fda77fa030b6'
|
'ca4d3cceeb39b4115d85516ab5a8eabd0b646b7a33ed718160ec335fe220261a'
|
||||||
'9e2d75b7a9dc421122d673fe520ef17f')
|
'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() {
|
build() {
|
||||||
cd "$srcdir/${pkgname}-${pkgver}"
|
cd ${pkgname}-${pkgver}
|
||||||
make MALLOC=libc
|
#make MALLOC=libc
|
||||||
|
make
|
||||||
}
|
}
|
||||||
|
|
||||||
package() {
|
package() {
|
||||||
cd "$srcdir/${pkgname}-${pkgver}"
|
cd ${pkgname}-${pkgver}
|
||||||
mkdir -p $pkgdir/usr/bin
|
mkdir -p "${pkgdir}/usr/bin"
|
||||||
make INSTALL_BIN="$pkgdir/usr/bin" PREFIX=/usr install
|
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 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.service "$pkgdir"/usr/lib/systemd/system/redis.service
|
install -Dm644 "${srcdir}/redis.logrotate" "${pkgdir}/etc/logrotate.d/redis"
|
||||||
install -Dm644 "$srcdir/redis.logrotate" "$pkgdir/etc/logrotate.d/redis"
|
install -D -m644 redis.conf "${pkgdir}/etc/redis.conf"
|
||||||
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 -Dm644 "${srcdir}/redis.tmpfiles.d" "${pkgdir}/usr/lib/tmpfiles.d/redis.conf"
|
||||||
install -D -m644 "$srcdir/${pkgname}-${pkgver}/redis.conf" "$pkgdir/etc/redis.conf"
|
|
||||||
}
|
}
|
||||||
|
@ -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
|
|
14
redis/redis.install
Normal file
14
redis/redis.install
Normal file
@ -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"
|
||||||
|
}
|
@ -4,7 +4,8 @@ After=network.target
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=forking
|
Type=forking
|
||||||
PIDFile=/run/redis.pid
|
User=redis
|
||||||
|
PIDFile=/run/redis/redis.pid
|
||||||
ExecStartPre=/bin/mkdir -p /var/lib/redis
|
ExecStartPre=/bin/mkdir -p /var/lib/redis
|
||||||
ExecStart=/usr/bin/redis-server /etc/redis.conf
|
ExecStart=/usr/bin/redis-server /etc/redis.conf
|
||||||
ExecStop=/usr/bin/redis-cli shutdown
|
ExecStop=/usr/bin/redis-cli shutdown
|
||||||
|
1
redis/redis.tmpfiles.d
Normal file
1
redis/redis.tmpfiles.d
Normal file
@ -0,0 +1 @@
|
|||||||
|
d /run/redis 0755 redis redis -
|
Loading…
Reference in New Issue
Block a user