Patchwork [1/1] busybox-syslog: respect /etc/syslog-startup.conf in systemd

login
register
mail settings
Submitter Qi.Chen@windriver.com
Date July 18, 2013, 7:05 a.m.
Message ID <7a265612fe08a636afc61a659ac5fadd22b0a7bd.1374116641.git.Qi.Chen@windriver.com>
Download mbox | patch
Permalink /patch/53941/
State New
Headers show

Comments

Qi.Chen@windriver.com - July 18, 2013, 7:05 a.m.
From: Chen Qi <Qi.Chen@windriver.com>

Now we've used busybox-syslog as a replacement for systemd's syslog
service. Currently, there are two problems.

1. The configuration file, /etc/syslog-startup.conf, is ignored.
   This is really confusing, as we are used to the behaviour of
   changing the configuration in /etc/syslog-startup.conf for the
   syslog service. This is actually a weekly test case.
2. The /etc/init.d/syslog is installed, but it has no real usage in
   systemd based systems.

This patch solves the above two problems by changing the busybox-syslog.
service file to let the /etc/init.d/syslog script start syslog service.
The /etc/init.d/syslog file is actually a wrapper in this situation.

[YOCTO #4860]
[YOCOT #4837]

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 meta/recipes-core/busybox/busybox.inc              |    2 +-
 .../busybox/files/busybox-syslog.service.in        |    3 +--
 meta/recipes-core/busybox/files/syslog             |    7 +++++++
 3 files changed, 9 insertions(+), 3 deletions(-)
Ross Burton - July 18, 2013, 5:07 p.m.
On 18 July 2013 08:05,  <Qi.Chen@windriver.com> wrote:
> 1. The configuration file, /etc/syslog-startup.conf, is ignored.
>    This is really confusing, as we are used to the behaviour of
>    changing the configuration in /etc/syslog-startup.conf for the
>    syslog service. This is actually a weekly test case.
> 2. The /etc/init.d/syslog is installed, but it has no real usage in
>    systemd based systems.
>
> This patch solves the above two problems by changing the busybox-syslog.
> service file to let the /etc/init.d/syslog script start syslog service.
> The /etc/init.d/syslog file is actually a wrapper in this situation.

(2) can be solved by not installing it (and there's work on-going to
make the init classes delete scripts that are installed as
appropriate).  I don't like this solution for (1) to be honest - I'd
prefer to see the logic in a central wrapper that the service (and
probably the init script) could invoke.

Ross
Qi.Chen@windriver.com - July 19, 2013, 1:59 a.m.
On 07/19/2013 01:07 AM, Burton, Ross wrote:
> On 18 July 2013 08:05,  <Qi.Chen@windriver.com> wrote:
>> 1. The configuration file, /etc/syslog-startup.conf, is ignored.
>>     This is really confusing, as we are used to the behaviour of
>>     changing the configuration in /etc/syslog-startup.conf for the
>>     syslog service. This is actually a weekly test case.
>> 2. The /etc/init.d/syslog is installed, but it has no real usage in
>>     systemd based systems.
>>
>> This patch solves the above two problems by changing the busybox-syslog.
>> service file to let the /etc/init.d/syslog script start syslog service.
>> The /etc/init.d/syslog file is actually a wrapper in this situation.
> (2) can be solved by not installing it (and there's work on-going to
> make the init classes delete scripts that are installed as
> appropriate).
Great. Thanks.

>    I don't like this solution for (1) to be honest - I'd
> prefer to see the logic in a central wrapper that the service (and
> probably the init script) could invoke.

Yes, that makes more sense. I'll rework on this patch.
Thanks for you review.

Best Regards,
Chen Qi
>
> Ross
>
>

Patch

diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc
index acd2bfb..1095be6 100644
--- a/meta/recipes-core/busybox/busybox.inc
+++ b/meta/recipes-core/busybox/busybox.inc
@@ -267,7 +267,7 @@  do_install () {
 
     if ${@base_contains('DISTRO_FEATURES','systemd','true','false',d)}; then
         install -d ${D}${systemd_unitdir}/system
-        sed 's,@base_sbindir@,${base_sbindir},g' < ${WORKDIR}/busybox-syslog.service.in \
+        sed 's,@sysconfdir@,${sysconfdir},g' < ${WORKDIR}/busybox-syslog.service.in \
             > ${D}${systemd_unitdir}/system/busybox-syslog.service
         sed 's,@base_sbindir@,${base_sbindir},g' < ${WORKDIR}/busybox-klogd.service.in \
             > ${D}${systemd_unitdir}/system/busybox-klogd.service
diff --git a/meta/recipes-core/busybox/files/busybox-syslog.service.in b/meta/recipes-core/busybox/files/busybox-syslog.service.in
index 2e04321..f849a61 100644
--- a/meta/recipes-core/busybox/files/busybox-syslog.service.in
+++ b/meta/recipes-core/busybox/files/busybox-syslog.service.in
@@ -3,8 +3,7 @@  Description=System Logging Service
 Wants=busybox-klogd.service
 
 [Service]
-EnvironmentFile=-/etc/default/busybox-syslog
-ExecStart=@base_sbindir@/syslogd -n $OPTIONS
+ExecStart=@sysconfdir@/init.d/syslog systemd
 Sockets=syslog.socket
 
 [Install]
diff --git a/meta/recipes-core/busybox/files/syslog b/meta/recipes-core/busybox/files/syslog
index 2944d3d..98eda80 100644
--- a/meta/recipes-core/busybox/files/syslog
+++ b/meta/recipes-core/busybox/files/syslog
@@ -68,6 +68,13 @@  case "$1" in
   	$0 stop
 	$0 start
 	;;
+  systemd)
+	# This action is only for systemd based images. It's kind of ugly here.
+	# But as we're using busybox-syslog as the syslog service in systemd images,
+	# and we want to respect the configurations in /etc/syslog-startup.conf,
+	# this is an easy way to achieve this goal without duplicating codes.
+	/sbin/syslogd -n $SYSLOG_ARGS
+	;;
   *)
 	echo "Usage: syslog { start | stop | restart }" >&2
 	exit 1