Openembedded Devel Discussions
 help / color / mirror / Atom feed
From: Alejandro Hernandez <alejandro.hernandez@linux.intel.com>
To: openembedded-devel@lists.openembedded.org
Subject: [PATCH] nginx: Add suport for systemd
Date: Fri, 15 May 2015 01:46:08 -0500	[thread overview]
Message-ID: <1431672369-15915-1-git-send-email-alejandro.hernandez@linux.intel.com> (raw)

Adds support for systemd, creates a service for nginx and installs it if required

Signed-off-by: Alejandro Hernandez <alejandro.hernandez@linux.intel.com>
---
 meta-webserver/recipes-httpd/nginx/files/nginx.service | 12 ++++++++++++
 meta-webserver/recipes-httpd/nginx/nginx_1.4.4.bb      | 13 ++++++++++++-
 2 files changed, 24 insertions(+), 1 deletion(-)
 create mode 100644 meta-webserver/recipes-httpd/nginx/files/nginx.service

diff --git a/meta-webserver/recipes-httpd/nginx/files/nginx.service b/meta-webserver/recipes-httpd/nginx/files/nginx.service
new file mode 100644
index 0000000..705450e
--- /dev/null
+++ b/meta-webserver/recipes-httpd/nginx/files/nginx.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Nginx Server
+After=network.target
+[Service]
+Type=forking
+PIDFile=@SYSCONFDIR@/nginx/run/nginx.pid
+ExecStartPre=mkdir -p @LOCALSTATEDIR@/log/nginx
+ExecStart=@SYSCONFDIR@/init.d/nginx start
+ExecStop=@SYSCONFDIR@/init.d/nginx stop
+[Install]
+WantedBy=multi-user.target
+
diff --git a/meta-webserver/recipes-httpd/nginx/nginx_1.4.4.bb b/meta-webserver/recipes-httpd/nginx/nginx_1.4.4.bb
index e78ed34..0dfdb5b 100644
--- a/meta-webserver/recipes-httpd/nginx/nginx_1.4.4.bb
+++ b/meta-webserver/recipes-httpd/nginx/nginx_1.4.4.bb
@@ -17,6 +17,7 @@ SRC_URI = " \
 	file://nginx.conf \
 	file://nginx.init \
 	file://nginx-volatile.conf \
+	file://nginx.service \
 "
 SRC_URI[md5sum] = "5dfaba1cbeae9087f3949860a02caa9f"
 SRC_URI[sha256sum] = "7c989a58e5408c9593da0bebcd0e4ffc3d892d1316ba5042ddb0be5b0b4102b9"
@@ -81,6 +82,14 @@ do_install () {
 	install -d ${D}${sysconfdir}/default/volatiles
 	install -m 0644 ${WORKDIR}/nginx-volatile.conf ${D}${sysconfdir}/default/volatiles/99_nginx
 	sed -i 's,/var/,${localstatedir}/,g' ${D}${sysconfdir}/default/volatiles/99_nginx
+
+        if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)};then
+            install -d ${D}${systemd_unitdir}/system
+            install -m 0644 ${WORKDIR}/nginx.service ${D}${systemd_unitdir}/system/
+            sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' \
+                    -e 's,@LOCALSTATEDIR@,${localstatedir},g' \
+                    ${D}${systemd_unitdir}/system/nginx.service
+        fi
 }
 
 pkg_postinst_${PN} () {
@@ -93,7 +102,9 @@ pkg_postinst_${PN} () {
 	fi
 }
 
-FILES_${PN} += "${localstatedir}/"
+FILES_${PN} += "${localstatedir}/ \
+                ${systemd_unitdir}/system/nginx.service \
+                "
 
 CONFFILES_${PN} = "${sysconfdir}/nginx/nginx.conf \
 		${sysconfdir}/nginx/fastcgi.conf\
-- 
1.9.1



             reply	other threads:[~2015-05-15  6:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-15  6:46 Alejandro Hernandez [this message]
2015-05-15  6:46 ` [meta-webserver][PATCH] php-fpm: Add support for systemd Alejandro Hernandez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1431672369-15915-1-git-send-email-alejandro.hernandez@linux.intel.com \
    --to=alejandro.hernandez@linux.intel.com \
    --cc=openembedded-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox