diff options
author | Frank Meerkoetter <meerkoetter@googlemail.com> | 2016-12-01 19:45:23 +0100 |
---|---|---|
committer | Martin Jansa <Martin.Jansa@gmail.com> | 2016-12-09 12:02:12 +0100 |
commit | 142faee1734300a041fe16265cb63cd17fb742ae (patch) | |
tree | 73c993f801c01a4fe7fb9d2edfa45e10da10a522 /meta-oe/recipes-extended/redis | |
parent | 5f85256b46ba2d89bf27f9d3edd607c4b59cf389 (diff) | |
download | meta-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.service | 14 | ||||
-rw-r--r-- | meta-oe/recipes-extended/redis/redis_3.0.2.bb | 15 |
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] | ||
2 | Description=Redis In-Memory Data Store | ||
3 | After=network.target | ||
4 | |||
5 | [Service] | ||
6 | User=root | ||
7 | Group=root | ||
8 | ExecStart=/usr/bin/redis-server /etc/redis/redis.conf | ||
9 | ExecStop=/usr/bin/redis-cli shutdown | ||
10 | Restart=always | ||
11 | |||
12 | [Install] | ||
13 | WantedBy=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 | ||
18 | SRC_URI[md5sum] = "87be8867447f62524b584813e5a7bd14" | 19 | SRC_URI[md5sum] = "87be8867447f62524b584813e5a7bd14" |
19 | SRC_URI[sha256sum] = "93e422c0d584623601f89b956045be158889ebe594478a2c24e1bf218495633f" | 20 | SRC_URI[sha256sum] = "93e422c0d584623601f89b956045be158889ebe594478a2c24e1bf218495633f" |
20 | 21 | ||
21 | inherit autotools-brokensep update-rc.d | 22 | inherit autotools-brokensep update-rc.d systemd |
23 | |||
24 | REDIS_ON_SYSTEMD = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}" | ||
22 | 25 | ||
23 | do_install() { | 26 | do_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 | ||
33 | CONFFILES_${PN} = "${sysconfdir}/redis/redis.conf" | 44 | CONFFILES_${PN} = "${sysconfdir}/redis/redis.conf" |
34 | 45 | ||
35 | INITSCRIPT_NAME = "redis-server" | 46 | INITSCRIPT_NAME = "redis-server" |
36 | INITSCRIPT_PARAMS = "defaults 87" | 47 | INITSCRIPT_PARAMS = "defaults 87" |
48 | |||
49 | SYSTEMD_SERVICE_${PN} = "redis.service" | ||