Patchwork [meta-oe,4/5] busybox: add systemd support for syslog service

login
register
mail settings
Submitter Otavio Salvador
Date Jan. 6, 2012, 6:59 p.m.
Message ID <5456f45166311ed151abb6b3bbf80a3c2f3940a9.1325876341.git.otavio@ossystems.com.br>
Download mbox | patch
Permalink /patch/18689/
State Accepted
Commit c48a6a605c6d8d38cfbc5df39b3dc310bffc07c1
Headers show

Comments

Otavio Salvador - Jan. 6, 2012, 6:59 p.m.
This uses a busybox-syslog default file to pass options to
syslogd. For it, the 'OPTIONS' variable needs to be set.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
 .../busybox/busybox/busybox-klogd.service.in       |    8 +++++
 .../busybox/busybox/busybox-syslog.default         |    1 +
 .../busybox/busybox/busybox-syslog.service.in      |   13 ++++++++
 .../recipes-core/busybox/busybox_1.19.3.bbappend   |   30 ++++++++++++++++++++
 4 files changed, 52 insertions(+), 0 deletions(-)
 create mode 100644 meta-oe/recipes-core/busybox/busybox/busybox-klogd.service.in
 create mode 100644 meta-oe/recipes-core/busybox/busybox/busybox-syslog.default
 create mode 100644 meta-oe/recipes-core/busybox/busybox/busybox-syslog.service.in
 create mode 100644 meta-oe/recipes-core/busybox/busybox_1.19.3.bbappend

Patch

diff --git a/meta-oe/recipes-core/busybox/busybox/busybox-klogd.service.in b/meta-oe/recipes-core/busybox/busybox/busybox-klogd.service.in
new file mode 100644
index 0000000..d7c7755
--- /dev/null
+++ b/meta-oe/recipes-core/busybox/busybox/busybox-klogd.service.in
@@ -0,0 +1,8 @@ 
+[Unit]
+Description=Kernel Logging Service
+
+[Service]
+ExecStart=@base_sbindir@/klogd -n
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta-oe/recipes-core/busybox/busybox/busybox-syslog.default b/meta-oe/recipes-core/busybox/busybox/busybox-syslog.default
new file mode 100644
index 0000000..8a21e6d
--- /dev/null
+++ b/meta-oe/recipes-core/busybox/busybox/busybox-syslog.default
@@ -0,0 +1 @@ 
+OPTIONS="-C64"
diff --git a/meta-oe/recipes-core/busybox/busybox/busybox-syslog.service.in b/meta-oe/recipes-core/busybox/busybox/busybox-syslog.service.in
new file mode 100644
index 0000000..db90082
--- /dev/null
+++ b/meta-oe/recipes-core/busybox/busybox/busybox-syslog.service.in
@@ -0,0 +1,13 @@ 
+[Unit]
+Description=System Logging Service
+
+[Service]
+ExecStartPre=/bin/systemctl stop systemd-kmsg-syslogd.service
+EnvironmentFile=-/etc/default/busybox-syslog
+ExecStart=@base_sbindir@/syslogd -n $OPTIONS
+Sockets=syslog.socket
+Wants=busybox-klogd.service
+
+[Install]
+WantedBy=multi-user.target
+Also=busybox-klogd.service
diff --git a/meta-oe/recipes-core/busybox/busybox_1.19.3.bbappend b/meta-oe/recipes-core/busybox/busybox_1.19.3.bbappend
new file mode 100644
index 0000000..46177e3
--- /dev/null
+++ b/meta-oe/recipes-core/busybox/busybox_1.19.3.bbappend
@@ -0,0 +1,30 @@ 
+inherit systemd
+
+PRINC := "${@int(PRINC) + 1}"
+
+# look for files in the layer first
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+SRC_URI += "file://busybox-syslog.service.in \
+            file://busybox-klogd.service.in \
+            file://busybox-syslog.default"
+
+SYSTEMD_PACKAGES = "${PN}-syslog-systemd"
+SYSTEMD_SERVICE_${PN}-syslog-systemd = "busybox-syslog.service"
+
+do_install_append() {
+	install -m 0644 ${WORKDIR}/busybox-syslog.default ${D}${sysconfdir}/default/busybox-syslog
+
+	install -d ${D}${base_libdir}/systemd/system
+	sed 's,@base_sbindir@,${base_sbindir},g' < ${WORKDIR}/busybox-syslog.service.in \
+	     > ${D}${base_libdir}/systemd/system/busybox-syslog.service
+	sed 's,@base_sbindir@,${base_sbindir},g' < ${WORKDIR}/busybox-klogd.service.in \
+	     > ${D}${base_libdir}/systemd/system/busybox-klogd.service
+
+	ln -sf /dev/null ${D}${base_libdir}/systemd/system/syslog.service
+}
+
+PACKAGES += "${PN}-syslog-systemd"
+
+RDEPENDS_${PN}-syslog-systemd += "${PN}-syslog"
+FILES_${PN}-syslog-systemd = "${base_libdir}/systemd"