Patchwork [V3,4/5] distcc: add systemd support

login
register
mail settings
Submitter Qi.Chen@windriver.com
Date Jan. 20, 2014, 2:23 a.m.
Message ID <6d96cc0ba2fd492a3779169fdf687a76658f0bdf.1390184362.git.Qi.Chen@windriver.com>
Download mbox | patch
Permalink /patch/65211/
State New
Headers show

Comments

Qi.Chen@windriver.com - Jan. 20, 2014, 2:23 a.m.
Add systemd support for distcc.

These unit files mainly use the same files in Fedora 20 as a reference.

[YOCTO #4420]

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 meta/recipes-devtools/distcc/distcc_3.1.bb         |   14 +++++++++++---
 meta/recipes-devtools/distcc/files/default         |    5 +++++
 meta/recipes-devtools/distcc/files/distccd.service |   11 +++++++++++
 3 files changed, 27 insertions(+), 3 deletions(-)
 create mode 100644 meta/recipes-devtools/distcc/files/distccd.service

Patch

diff --git a/meta/recipes-devtools/distcc/distcc_3.1.bb b/meta/recipes-devtools/distcc/distcc_3.1.bb
index e351a58..c3cbd05 100644
--- a/meta/recipes-devtools/distcc/distcc_3.1.bb
+++ b/meta/recipes-devtools/distcc/distcc_3.1.bb
@@ -22,12 +22,13 @@  SRC_URI = "http://distcc.googlecode.com/files/${BPN}-${PV}.tar.bz2 \
            file://separatebuilddir.patch \
            file://default \
            file://distccmon-gnome.desktop \
-           file://distcc"
+           file://distcc \
+           file://distccd.service"
 
 SRC_URI[md5sum] = "a1a9d3853df7133669fffec2a9aab9f3"
 SRC_URI[sha256sum] = "f55dbafd76bed3ce57e1bbcdab1329227808890d90f4c724fcd2d53f934ddd89"
 
-inherit autotools pkgconfig update-rc.d useradd
+inherit autotools pkgconfig update-rc.d useradd systemd
 
 EXTRA_OECONF += "--disable-Werror PYTHON=/dev/null"
 
@@ -40,11 +41,17 @@  USERADD_PARAM_${PN} = "--system \
 
 INITSCRIPT_NAME = "distcc"
 
+SYSTEMD_PACKAGES = "${PN}"
+SYSTEMD_SERVICE_${PN} = "distccd.service"
+
 do_install_append() {
     install -d ${D}${sysconfdir}/init.d/
     install -d ${D}${sysconfdir}/default
     install -m 0755 ${WORKDIR}/distcc ${D}${sysconfdir}/init.d/
     install -m 0755 ${WORKDIR}/default ${D}${sysconfdir}/default/distcc
+    install -d ${D}${systemd_unitdir}/system/
+    install -m 0644 ${WORKDIR}/distccd.service ${D}${systemd_unitdir}/system
+    sed -i -e 's,@BINDIR@,${bindir},g' ${D}${systemd_unitdir}/system/distccd.service
     ${DESKTOPINSTALL}
 }
 DESKTOPINSTALL = ""
@@ -58,7 +65,8 @@  FILES_${PN} = " ${sysconfdir} \
 		${bindir}/distcc \
     ${bindir}/lsdistcc \
 		${bindir}/distccd \
-		${bindir}/distccmon-text"
+		${bindir}/distccmon-text \
+		${systemd_unitdir}/system/distccd.service"
 FILES_distcc-distmon-gnome = "  ${bindir}/distccmon-gnome \
 				${datadir}/distcc"
 
diff --git a/meta/recipes-devtools/distcc/files/default b/meta/recipes-devtools/distcc/files/default
index 95290f8..63c4159 100644
--- a/meta/recipes-devtools/distcc/files/default
+++ b/meta/recipes-devtools/distcc/files/default
@@ -17,3 +17,8 @@  STARTDISTCC="true"
 # ALLOWEDNETS="127.0.0.1"
 
 ALLOWEDNETS="192.168.7.0/24"
+
+#
+# OPTIONS is used for the systemd service file
+#
+OPTIONS="--allow 192.168.7.0/24"
diff --git a/meta/recipes-devtools/distcc/files/distccd.service b/meta/recipes-devtools/distcc/files/distccd.service
new file mode 100644
index 0000000..0253ddf
--- /dev/null
+++ b/meta/recipes-devtools/distcc/files/distccd.service
@@ -0,0 +1,11 @@ 
+[Unit]
+Description=Distccd A Distributed Compilation Server
+After=network.target
+
+[Service]
+User=distcc
+EnvironmentFile=-/etc/default/distcc
+ExecStart=@BINDIR@/distccd --verbose --no-detach --daemon $OPTIONS
+
+[Install]
+WantedBy=multi-user.target