Re: [oe] [meta-webserver][PATCH]nginx: optimize systemd unit file

2016-08-18 Thread Martin Jansa
On Thu, Aug 18, 2016 at 03:58:34PM +0200, Szombathelyi György wrote:
>  
> - Call the nginx binary directly, no need to
>   wrap the SysV init file.
> - Create /var/log/nginx with tmpfiles, like volatiles without systemd.
> - Run nginx with ${NGINX_USER} (user ${NGINX_USER} in nginx.conf)
> 
> Signed-off-by: Gyorgy Szombathelyi 
> 
> diff --git a/meta-webserver/recipes-httpd/nginx/files/nginx.service b/meta-
> webserver/recipes-httpd/nginx/files/nginx.service
> index 9926a4b..ce99061 100644
> --- a/meta-webserver/recipes-httpd/nginx/files/nginx.service
> +++ b/meta-webserver/recipes-httpd/nginx/files/nginx.service
> @@ -3,10 +3,9 @@ Description=Nginx Server
>  After=network.target
>  [Service]
>  Type=forking
> -PIDFile=@SYSCONFDIR@/nginx/run/nginx.pid
> -ExecStartPre=@BASEBINDIR@/mkdir -p @LOCALSTATEDIR@/log/nginx
> -ExecStart=@SYSCONFDIR@/init.d/nginx start
> -ExecStop=@SYSCONFDIR@/init.d/nginx stop
> +PIDFile=/run/nginx/nginx.pid
> +ExecStart=@SBINDIR@/nginx
> +ExecStop=@SBINDIR@/nginx -s stop
> +ExecReload=@SBINDIR@/nginx -s reload
>  [Install]
>  WantedBy=multi-user.target
> -
> diff --git a/meta-webserver/recipes-httpd/nginx/nginx.inc b/meta-webserver/
> recipes-httpd/nginx/nginx.inc
> index fe51ca0..25ac7a4 100644
> --- a/meta-webserver/recipes-httpd/nginx/nginx.inc
> +++ b/meta-webserver/recipes-httpd/nginx/nginx.inc
> @@ -75,6 +75,9 @@ do_install () {
> install -d ${D}${sysconfdir}/tmpfiles.d
> echo "d /run/${BPN} - - - -" \
>  > ${D}${sysconfdir}/tmpfiles.d/${BPN}.conf
> +echo "d /${localstatedir}/log/${BPN} 0755 root root -" \
> + >> ${D}${sysconfdir}/tmpfiles.d/${BPN}.conf
> +
> fi
> install -d ${D}${sysconfdir}/${BPN}
> ln -snf ${localstatedir}/run/${BPN} ${D}${sysconfdir}/${BPN}/run
> @@ -90,6 +93,7 @@ do_install () {
> install -d ${D}${sysconfdir}/nginx
> install -m 0644 ${WORKDIR}/nginx.conf ${D}${sysconfdir}/nginx/
> nginx.conf
> sed -i 's,/var/,${localstatedir}/,g' ${D}${sysconfdir}/nginx/
> nginx.conf
> +   sed -i 's/^user.*/user ${NGINX_USER};/g' ${D}${sysconfdir}/nginx/
> nginx.conf
> install -d ${D}${sysconfdir}/nginx/sites-enabled

Please fix your sender to stop wrapping long lines.

OE @ ~/meta-openembedded $ pwam 129537
2016-08-18 17:58:48
URL:https://patchwork.openembedded.org/patch/129537/mbox/ [3015] ->
"pw-am-129537.patch" [1]
Applying: nginx: optimize systemd unit file
fatal: corrupt patch at line 41
Patch failed at 0001 nginx: optimize systemd unit file
The copy of the patch that failed is found in: .git/rebase-apply/patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".


> install -d ${D}${sysconfdir}/default/volatiles
> @@ -101,7 +105,7 @@ do_install () {
>  install -m 0644 ${WORKDIR}/nginx.service ${D}${systemd_unitdir}/
> system/
>  sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' \
>  -e 's,@LOCALSTATEDIR@,${localstatedir},g' \
> --e 's,@BASEBINDIR@,${base_bindir},g' \
> +-e 's,@SBINDIR@,${sbindir},g' \
>  ${D}${systemd_unitdir}/system/nginx.service
>  fi
>  }
> 
> -- 
> ___
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-devel

-- 
Martin 'JaMa' Jansa jabber: martin.ja...@gmail.com


signature.asc
Description: Digital signature
-- 
___
Openembedded-devel mailing list
Openembedded-devel@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-devel


[oe] [meta-webserver][PATCH]nginx: optimize systemd unit file

2016-08-18 Thread Szombathelyi György
 
- Call the nginx binary directly, no need to
  wrap the SysV init file.
- Create /var/log/nginx with tmpfiles, like volatiles without systemd.
- Run nginx with ${NGINX_USER} (user ${NGINX_USER} in nginx.conf)

Signed-off-by: Gyorgy Szombathelyi 

diff --git a/meta-webserver/recipes-httpd/nginx/files/nginx.service b/meta-
webserver/recipes-httpd/nginx/files/nginx.service
index 9926a4b..ce99061 100644
--- a/meta-webserver/recipes-httpd/nginx/files/nginx.service
+++ b/meta-webserver/recipes-httpd/nginx/files/nginx.service
@@ -3,10 +3,9 @@ Description=Nginx Server
 After=network.target
 [Service]
 Type=forking
-PIDFile=@SYSCONFDIR@/nginx/run/nginx.pid
-ExecStartPre=@BASEBINDIR@/mkdir -p @LOCALSTATEDIR@/log/nginx
-ExecStart=@SYSCONFDIR@/init.d/nginx start
-ExecStop=@SYSCONFDIR@/init.d/nginx stop
+PIDFile=/run/nginx/nginx.pid
+ExecStart=@SBINDIR@/nginx
+ExecStop=@SBINDIR@/nginx -s stop
+ExecReload=@SBINDIR@/nginx -s reload
 [Install]
 WantedBy=multi-user.target
-
diff --git a/meta-webserver/recipes-httpd/nginx/nginx.inc b/meta-webserver/
recipes-httpd/nginx/nginx.inc
index fe51ca0..25ac7a4 100644
--- a/meta-webserver/recipes-httpd/nginx/nginx.inc
+++ b/meta-webserver/recipes-httpd/nginx/nginx.inc
@@ -75,6 +75,9 @@ do_install () {
install -d ${D}${sysconfdir}/tmpfiles.d
echo "d /run/${BPN} - - - -" \
 > ${D}${sysconfdir}/tmpfiles.d/${BPN}.conf
+echo "d /${localstatedir}/log/${BPN} 0755 root root -" \
+ >> ${D}${sysconfdir}/tmpfiles.d/${BPN}.conf
+
fi
install -d ${D}${sysconfdir}/${BPN}
ln -snf ${localstatedir}/run/${BPN} ${D}${sysconfdir}/${BPN}/run
@@ -90,6 +93,7 @@ do_install () {
install -d ${D}${sysconfdir}/nginx
install -m 0644 ${WORKDIR}/nginx.conf ${D}${sysconfdir}/nginx/
nginx.conf
sed -i 's,/var/,${localstatedir}/,g' ${D}${sysconfdir}/nginx/
nginx.conf
+   sed -i 's/^user.*/user ${NGINX_USER};/g' ${D}${sysconfdir}/nginx/
nginx.conf
install -d ${D}${sysconfdir}/nginx/sites-enabled
 
install -d ${D}${sysconfdir}/default/volatiles
@@ -101,7 +105,7 @@ do_install () {
 install -m 0644 ${WORKDIR}/nginx.service ${D}${systemd_unitdir}/
system/
 sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' \
 -e 's,@LOCALSTATEDIR@,${localstatedir},g' \
--e 's,@BASEBINDIR@,${base_bindir},g' \
+-e 's,@SBINDIR@,${sbindir},g' \
 ${D}${systemd_unitdir}/system/nginx.service
 fi
 }

-- 
___
Openembedded-devel mailing list
Openembedded-devel@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-devel