Skip to contentSkip to conversation

nginx: Add suport for systemd

PATCH New Alejandro Hernandez 1 participant 2 messages May 15, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nginx: Add suport for systemd

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

---
 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
meta-webserver/recipes-httpd/nginx/files/nginx.service new file +12 -0
new file mode 100644
index 0000000..705450e
@@ -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
+
meta-webserver/recipes-httpd/nginx/nginx_1.4.4.bb +12 -1
index e78ed34..0dfdb5b 100644
@@ -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\
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 php-fpm: Add support for systemd

Adds suport for systemd, creates a service for php-fpm and installs it if required

---
 meta-oe/recipes-devtools/php/php/php-fpm.service | 10 ++++++++++
 meta-oe/recipes-devtools/php/php_5.5.24.bb       | 13 ++++++++++++-
 2 files changed, 22 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-devtools/php/php/php-fpm.service
meta-oe/recipes-devtools/php/php/php-fpm.service new file +10 -0
new file mode 100644
index 0000000..ac79dc9
@@ -0,0 +1,10 @@
+[Unit]
+Description=PHP-FPM
+After=network.target
+[Service]
+Type=forking
+PIDFile=@LOCALSTATEDIR@/run/php-fpm.pid
+ExecStart=@SYSCONFDIR@/init.d/php-fpm start
+ExecStop=@SYSCONFDIR@/init.d/php-fpm stop
+[Install]
+WantedBy=multi-user.target
meta-oe/recipes-devtools/php/php_5.5.24.bb +12 -1
index 76185fb..3e656af 100644
@@ -27,6 +27,7 @@ SRC_URI_append_class-target += " \
             file://configure.patch \
             file://pthread-check-threads-m4.patch \
             file://70_mod_php5.conf \
+            file://php-fpm.service \
           "
 
 SRC_URI[md5sum] = "f9a8f3e4bb88b33b087bd63732b1402a"
@@ -156,6 +157,16 @@ do_install_append_class-target() {
     sed -i 's:=/etc:=${sysconfdir}:g' ${B}/sapi/fpm/init.d.php-fpm
     sed -i 's:=/var:=${localstatedir}:g' ${B}/sapi/fpm/init.d.php-fpm
     install -m 0755 ${B}/sapi/fpm/init.d.php-fpm ${D}${sysconfdir}/init.d/php-fpm
+    install -m 0644 ${WORKDIR}/php-fpm-apache.conf ${D}/${sysconfdir}/apache2/conf.d/php-fpm.conf
+
+    if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)};then
+        install -d ${D}${systemd_unitdir}/system
+        install -m 0644 ${WORKDIR}/php-fpm.service ${D}${systemd_unitdir}/system/
+        sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' \
+            -e 's,@LOCALSTATEDIR@,${localstatedir},g' \
+            ${D}${systemd_unitdir}/system/php-fpm.service
+    fi
+
     TMP=`dirname ${D}/${TMPDIR}`
     while test ${TMP} != ${D}; do
         rmdir ${TMP}
@@ -206,7 +217,7 @@ FILES_${PN}-doc += "${PHP_LIBDIR}/php/doc"
 FILES_${PN}-cli = "${bindir}/php"
 FILES_${PN}-phar = "${bindir}/phar*"
 FILES_${PN}-cgi = "${bindir}/php-cgi"
-FILES_${PN}-fpm = "${sbindir}/php-fpm ${sysconfdir}/php-fpm.conf ${datadir}/fpm ${sysconfdir}/init.d/php-fpm"
+FILES_${PN}-fpm = "${sbindir}/php-fpm ${sysconfdir}/php-fpm.conf ${datadir}/fpm ${sysconfdir}/init.d/php-fpm ${systemd_unitdir}/system/php-fpm.service"
 FILES_${PN}-fpm-apache2 = "${sysconfdir}/apache2/conf.d/php-fpm.conf"
 CONFFILES_${PN}-fpm = "${sysconfdir}/php-fpm.conf"
 CONFFILES_${PN}-fpm-apache2 = "${sysconfdir}/apache2/conf.d/php-fpm.conf"
Signature · 1 line
1.9.1