Hi,

Please use "${systemd_system_unitdir}" instead of
"${systemd_unitdir}/system".

Pau Espin Pedrol

2016-11-29 11:04 GMT+01:00 Frank Meerkoetter <meerkoet...@googlemail.com>:

> 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 <fr...@meerkoetter.org>
> ---
>  meta-oe/recipes-extended/redis/redis/redis.service | 14 ++++++++++++++
>  meta-oe/recipes-extended/redis/redis_3.0.2.bb      | 15 ++++++++++++++-
>  2 files changed, 28 insertions(+), 1 deletion(-)
>  create mode 100644 meta-oe/recipes-extended/redis/redis/redis.service
>
> 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 0000000..e2dc6a7
> --- /dev/null
> +++ b/meta-oe/recipes-extended/redis/redis/redis.service
> @@ -0,0 +1,14 @@
> +[Unit]
> +Description=Redis In-Memory Data Store
> +After=network.target
> +
> +[Service]
> +User=root
> +Group=root
> +ExecStart=/usr/bin/redis-server /etc/redis/redis.conf
> +ExecStop=/usr/bin/redis-cli shutdown
> +Restart=always
> +
> +[Install]
> +WantedBy=multi-user.target
> +
> 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 2e4b760..89b79d4 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 \
>             file://oe-use-libc-malloc.patch \
>             file://redis.conf \
>             file://init-redis-server \
> +           file://redis.service \
>             file://hiredis-update-Makefile-to-add-symbols-to-staticlib.patch
> \
>  "
>
>  SRC_URI[md5sum] = "87be8867447f62524b584813e5a7bd14"
>  SRC_URI[sha256sum] = "93e422c0d584623601f89b956045be
> 158889ebe594478a2c24e1bf218495633f"
>
> -inherit autotools-brokensep update-rc.d
> +inherit autotools-brokensep update-rc.d systemd
> +
> +REDIS_ON_SYSTEMD = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd',
> 'true', 'false', d)}"
>
>  do_install() {
>      export PREFIX=${D}/${prefix}
> @@ -28,9 +31,19 @@ do_install() {
>      install -d ${D}/${sysconfdir}/init.d
>      install -m 0755 ${WORKDIR}/init-redis-server
> ${D}/${sysconfdir}/init.d/redis-server
>      install -d ${D}/var/lib/redis/
> +
> +    install -d ${D}${systemd_unitdir}/system
> +    install -m 0644 ${WORKDIR}/redis.service ${D}${systemd_unitdir}/system
> +    sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${systemd_unitdir}/system/
> redis.service
> +
> +    if [ "${REDIS_ON_SYSTEMD}" = true ]; then
> +        sed -i 's!daemonize yes!# daemonize yes!'
> ${D}/${sysconfdir}/redis/redis.conf
> +    fi
>  }
>
>  CONFFILES_${PN} = "${sysconfdir}/redis/redis.conf"
>
>  INITSCRIPT_NAME = "redis-server"
>  INITSCRIPT_PARAMS = "defaults 87"
> +
> +SYSTEMD_SERVICE_${PN} = "redis.service"
> --
> 2.7.4
>
> --
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-devel
>
-- 
_______________________________________________
Openembedded-devel mailing list
Openembedded-devel@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

Reply via email to