summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-extended/redis
diff options
context:
space:
mode:
authorFrank Meerkoetter <meerkoetter@googlemail.com>2016-12-01 19:45:23 +0100
committerMartin Jansa <Martin.Jansa@gmail.com>2016-12-09 12:02:12 +0100
commit142faee1734300a041fe16265cb63cd17fb742ae (patch)
tree73c993f801c01a4fe7fb9d2edfa45e10da10a522 /meta-oe/recipes-extended/redis
parent5f85256b46ba2d89bf27f9d3edd607c4b59cf389 (diff)
downloadmeta-openembedded-142faee1734300a041fe16265cb63cd17fb742ae.tar.gz
redis: add a systemd service file
The redis.conf is changed on the fly to not daemonize redis. The reason for that is that with this appraoch we don't need special permissions to write to /var/run/. Signed-off-by: Frank Meerkoetter <frank@meerkoetter.org> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'meta-oe/recipes-extended/redis')
-rw-r--r--meta-oe/recipes-extended/redis/redis/redis.service14
-rw-r--r--meta-oe/recipes-extended/redis/redis_3.0.2.bb15
2 files changed, 28 insertions, 1 deletions
diff --git a/meta-oe/recipes-extended/redis/redis/redis.service b/meta-oe/recipes-extended/redis/redis/redis.service
new file mode 100644
index 000000000..e2dc6a715
--- /dev/null
+++ b/meta-oe/recipes-extended/redis/redis/redis.service
@@ -0,0 +1,14 @@
1[Unit]
2Description=Redis In-Memory Data Store
3After=network.target
4
5[Service]
6User=root
7Group=root
8ExecStart=/usr/bin/redis-server /etc/redis/redis.conf
9ExecStop=/usr/bin/redis-cli shutdown
10Restart=always
11
12[Install]
13WantedBy=multi-user.target
14
diff --git a/meta-oe/recipes-extended/redis/redis_3.0.2.bb b/meta-oe/recipes-extended/redis/redis_3.0.2.bb
index 2e4b760cc..98132d798 100644
--- a/meta-oe/recipes-extended/redis/redis_3.0.2.bb
+++ b/meta-oe/recipes-extended/redis/redis_3.0.2.bb
@@ -12,13 +12,16 @@ SRC_URI = "http://download.redis.io/releases/${BP}.tar.gz \
12 file://oe-use-libc-malloc.patch \ 12 file://oe-use-libc-malloc.patch \
13 file://redis.conf \ 13 file://redis.conf \
14 file://init-redis-server \ 14 file://init-redis-server \
15 file://redis.service \
15 file://hiredis-update-Makefile-to-add-symbols-to-staticlib.patch \ 16 file://hiredis-update-Makefile-to-add-symbols-to-staticlib.patch \
16" 17"
17 18
18SRC_URI[md5sum] = "87be8867447f62524b584813e5a7bd14" 19SRC_URI[md5sum] = "87be8867447f62524b584813e5a7bd14"
19SRC_URI[sha256sum] = "93e422c0d584623601f89b956045be158889ebe594478a2c24e1bf218495633f" 20SRC_URI[sha256sum] = "93e422c0d584623601f89b956045be158889ebe594478a2c24e1bf218495633f"
20 21
21inherit autotools-brokensep update-rc.d 22inherit autotools-brokensep update-rc.d systemd
23
24REDIS_ON_SYSTEMD = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}"
22 25
23do_install() { 26do_install() {
24 export PREFIX=${D}/${prefix} 27 export PREFIX=${D}/${prefix}
@@ -28,9 +31,19 @@ do_install() {
28 install -d ${D}/${sysconfdir}/init.d 31 install -d ${D}/${sysconfdir}/init.d
29 install -m 0755 ${WORKDIR}/init-redis-server ${D}/${sysconfdir}/init.d/redis-server 32 install -m 0755 ${WORKDIR}/init-redis-server ${D}/${sysconfdir}/init.d/redis-server
30 install -d ${D}/var/lib/redis/ 33 install -d ${D}/var/lib/redis/
34
35 install -d ${D}${systemd_system_unitdir}
36 install -m 0644 ${WORKDIR}/redis.service ${D}${systemd_system_unitdir}
37 sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${systemd_system_unitdir}/redis.service
38
39 if [ "${REDIS_ON_SYSTEMD}" = true ]; then
40 sed -i 's!daemonize yes!# daemonize yes!' ${D}/${sysconfdir}/redis/redis.conf
41 fi
31} 42}
32 43
33CONFFILES_${PN} = "${sysconfdir}/redis/redis.conf" 44CONFFILES_${PN} = "${sysconfdir}/redis/redis.conf"
34 45
35INITSCRIPT_NAME = "redis-server" 46INITSCRIPT_NAME = "redis-server"
36INITSCRIPT_PARAMS = "defaults 87" 47INITSCRIPT_PARAMS = "defaults 87"
48
49SYSTEMD_SERVICE_${PN} = "redis.service"