Skip to contentSkip to conversation

nginx: make nginx user and home directory configurable

PATCH In review Pascal Bach 2 participants 3 messages Feb 4, 2016 – Feb 20, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 nginx: make nginx user and home directory configurable

This allows selecting a different user then "www" in a bbappend.
It also allows to change the default value of "/var/www/localhost" to something else.

---
 meta-webserver/recipes-httpd/nginx/nginx_1.9.9.bb | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
meta-webserver/recipes-httpd/nginx/nginx_1.9.9.bb +8 -5
index 06d61c7..08f53a7 100644
@@ -27,6 +27,9 @@ inherit update-rc.d useradd
 CFLAGS_append = " -fPIE -pie"
 CXXFLAGS_append = " -fPIE -pie"
 
+NGINX_WWWDIR ?= "${localstatedir}/www/localhost"
+NGINX_USER   ?= "www"
+
 EXTRA_OECONF = ""
 
 do_configure () {
@@ -71,9 +74,9 @@ do_install () {
 	fi
 	install -d ${D}${sysconfdir}/${BPN}
 	ln -snf ${localstatedir}/run/${BPN} ${D}${sysconfdir}/${BPN}/run
-	install -d ${D}${localstatedir}/www/localhost
-	mv ${D}/usr/html ${D}${localstatedir}/www/localhost/
-	chown www:www-data -R ${D}${localstatedir}
+	install -d ${D}${NGINX_WWWDIR}
+	mv ${D}/usr/html ${D}${NGINX_WWWDIR}/
+	chown ${NGINX_USER}:www-data -R ${D}${NGINX_WWWDIR}
 
 	install -d ${D}${sysconfdir}/init.d
 	install -m 0755 ${WORKDIR}/nginx.init ${D}${sysconfdir}/init.d/nginx
@@ -130,6 +133,6 @@ INITSCRIPT_PARAMS = "defaults 92 20"
 USERADD_PACKAGES = "${PN}"
 USERADD_PARAM_${PN} = " \
     --system --no-create-home \
-    --home ${localstatedir}/www/localhost \
+    --home ${NGINX_WWWDIR} \
     --groups www-data \
-    --user-group www"
+    --user-group ${NGINX_USER}"
Signature · 1 line
2.1.4
#1 lore raw

PATCH 2/2 nginx: update to 1.9.10

---
 .../recipes-httpd/nginx/{nginx_1.9.9.bb => nginx_1.9.10.bb}         | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
 rename meta-webserver/recipes-httpd/nginx/{nginx_1.9.9.bb => nginx_1.9.10.bb} (95%)
meta-webserver/recipes-httpd/nginx/nginx_1.9.10.bb renamed from meta-webserver/recipes-httpd/nginx/nginx_1.9.9.bb +3 -3
similarity index 95%
rename from meta-webserver/recipes-httpd/nginx/nginx_1.9.9.bb
rename to meta-webserver/recipes-httpd/nginx/nginx_1.9.10.bb
index 08f53a7..5d63d41 100644
@@ -6,7 +6,7 @@ concurrency, performance and low memory usage."
 
 HOMEPAGE = "http://nginx.org/"
 LICENSE = "BSD-2-Clause"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=3845852aedfa8d6d7765f55d06cc3ebd"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=0bb58ed0dfd4f5dbece3b52aba79f023"
 SECTION = "net"
 
 DEPENDS = "libpcre gzip openssl"
@@ -19,8 +19,8 @@ SRC_URI = " \
 	file://nginx-volatile.conf \
 	file://nginx.service \
 "
-SRC_URI[md5sum] = "50fdfa08e93ead7a111cba5a5f5735af"
-SRC_URI[sha256sum] = "de66bb2b11c82533aa5cb5ccc27cbce736ab87c9f2c761e5237cda0b00068d73"
+SRC_URI[md5sum] = "64cc970988356a5e0fc4fcd1ab84fe57"
+SRC_URI[sha256sum] = "fb14d76844cab0a5a0880768be28965e74f9956790f618c454ef6098e26631d9"
 
 inherit update-rc.d useradd
 
Signature · 1 line
2.1.4
#2 lore raw
In reply to Pascal Bach
Quoted 2 lines · Pascal Bach

This allows selecting a different user then "www" in a bbappend.
It also allows to change the default value of "/var/www/localhost" to something else.

Missing SOB line in all your patches, please resend.

Quoted 48 lines
---
 meta-webserver/recipes-httpd/nginx/nginx_1.9.9.bb | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
meta-webserver/recipes-httpd/nginx/nginx_1.9.9.bb +8 -5
index 06d61c7..08f53a7 100644
@@ -27,6 +27,9 @@ inherit update-rc.d useradd
 CFLAGS_append = " -fPIE -pie"
 CXXFLAGS_append = " -fPIE -pie"
 
+NGINX_WWWDIR ?= "${localstatedir}/www/localhost"
+NGINX_USER   ?= "www"
+
 EXTRA_OECONF = ""
 
 do_configure () {
@@ -71,9 +74,9 @@ do_install () {
 	fi
 	install -d ${D}${sysconfdir}/${BPN}
 	ln -snf ${localstatedir}/run/${BPN} ${D}${sysconfdir}/${BPN}/run
-	install -d ${D}${localstatedir}/www/localhost
-	mv ${D}/usr/html ${D}${localstatedir}/www/localhost/
-	chown www:www-data -R ${D}${localstatedir}
+	install -d ${D}${NGINX_WWWDIR}
+	mv ${D}/usr/html ${D}${NGINX_WWWDIR}/
+	chown ${NGINX_USER}:www-data -R ${D}${NGINX_WWWDIR}
 
 	install -d ${D}${sysconfdir}/init.d
 	install -m 0755 ${WORKDIR}/nginx.init ${D}${sysconfdir}/init.d/nginx
@@ -130,6 +133,6 @@ INITSCRIPT_PARAMS = "defaults 92 20"
 USERADD_PACKAGES = "${PN}"
 USERADD_PARAM_${PN} = " \
     --system --no-create-home \
-    --home ${localstatedir}/www/localhost \
+    --home ${NGINX_WWWDIR} \
     --groups www-data \
-    --user-group www"
+    --user-group ${NGINX_USER}"
Signature · 7 lines
2.1.4

-- 
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel
Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]