Skip to contentSkip to conversation

systemd related fixes post 1.6

PATCH Superseded Chen Qi 2 participants 7 messages Apr 23, 2014 – Apr 24, 2014

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Chen Qi

author
#0 lore raw

cover systemd related fixes post 1.6

This patchset adds systemd unit files for four packages.

The following changes since commit bec37f8b85b6dd1e4e1c1b9b215a7952ca2fc386:

build-appliance-image: Update to head revision (2014-04-22 22:53:34 +0100)

are available in the git repository at:

git://git.openembedded.org/openembedded-core-contrib ChenQi/systemd-post-1.6
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=ChenQi/systemd-post-1.6

Chen Qi (4):
cronie: add systemd support
bind: add systemd support
ppp: add systemd support
tcf-agent: add systemd support

 .../bind/bind/generate-rndc-key.sh                 |    7 +++++++
 meta/recipes-connectivity/bind/bind/named.service  |   22 ++++++++++++++++++++
 meta/recipes-connectivity/bind/bind_9.9.5.bb       |   17 ++++++++++++++-
 meta/recipes-connectivity/ppp/ppp/[email protected]     |    9 ++++++++
 meta/recipes-connectivity/ppp/ppp_2.4.6.bb         |    9 ++++++--
 .../tcf-agent/tcf-agent/tcf-agent.service          |   10 +++++++++
 meta/recipes-devtools/tcf-agent/tcf-agent_git.bb   |    8 ++++++-
 meta/recipes-extended/cronie/cronie/crond.service  |   11 ++++++++++
 meta/recipes-extended/cronie/cronie_1.4.11.bb      |   12 ++++++++++-
 9 files changed, 100 insertions(+), 5 deletions(-)
 create mode 100644 meta/recipes-connectivity/bind/bind/generate-rndc-key.sh
 create mode 100644 meta/recipes-connectivity/bind/bind/named.service
 create mode 100644 meta/recipes-connectivity/ppp/ppp/[email protected]
 create mode 100644 meta/recipes-devtools/tcf-agent/tcf-agent/tcf-agent.service
 create mode 100644 meta/recipes-extended/cronie/cronie/crond.service
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH 1/4 cronie: add systemd support

Add systemd support for cronie.

---
 meta/recipes-extended/cronie/cronie/crond.service |   11 +++++++++++
 meta/recipes-extended/cronie/cronie_1.4.11.bb     |   12 +++++++++++-
 2 files changed, 22 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-extended/cronie/cronie/crond.service
meta/recipes-extended/cronie/cronie/crond.service new file +11 -0
new file mode 100644
index 0000000..d435a6e
@@ -0,0 +1,11 @@
+[Unit]
+Description=Periodic Command Scheduler
+
+[Service]
+EnvironmentFile=/etc/sysconfig/crond
+ExecStart=@SBINDIR@/crond -n $CRONDARGS
+ExecReload=@BASE_BINDIR@/kill -HUP $MAINPID
+Restart=always
+
+[Install]
+WantedBy=multi-user.target
meta/recipes-extended/cronie/cronie_1.4.11.bb +11 -1
index d98d0d9..2a932e0 100644
@@ -19,6 +19,7 @@ SRC_URI = "https://fedorahosted.org/releases/c/r/cronie/cronie-${PV}.tar.gz \
            file://fix-out-of-tree-build.patch \
            file://crond.init \
            file://crontab \
+           file://crond.service \
            ${@base_contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)}"
 
 PAM_SRC_URI = "file://crond_pam_config.patch"
@@ -27,7 +28,7 @@ PAM_DEPS = "libpam libpam-runtime pam-plugin-access pam-plugin-loginuid"
 SRC_URI[md5sum] = "2ba645cf54de17f138ef70312843862f"
 SRC_URI[sha256sum] = "fd08084cedddbb42499f80ddb7f2158195c3555c2ff40ee11d4ece2f9864d7be"
 
-inherit autotools update-rc.d useradd
+inherit autotools update-rc.d useradd systemd
 
 
 PACKAGECONFIG ?= "${@base_contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}"
@@ -42,12 +43,21 @@ INITSCRIPT_PARAMS = "start 90 2 3 4 5 . stop 60 0 1 6 ."
 USERADD_PACKAGES = "${PN}"
 GROUPADD_PARAM_${PN} = "--system crontab"
 
+SYSTEMD_SERVICE_${PN} = "crond.service"
+
 do_install_append () {
 	install -d ${D}${sysconfdir}/sysconfig/
 	install -d ${D}${sysconfdir}/init.d/
 	install -m 0644 ${S}/crond.sysconfig ${D}${sysconfdir}/sysconfig/crond
 	install -m 0755 ${WORKDIR}/crond.init ${D}${sysconfdir}/init.d/crond
 
+	# install systemd unit files
+	install -d ${D}${systemd_unitdir}/system
+	install -m 0644 ${WORKDIR}/crond.service ${D}${systemd_unitdir}/system
+	sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \
+	       -e 's,@SBINDIR@,${sbindir},g' \
+	       ${D}${systemd_unitdir}/system/crond.service
+
 	# below are necessary for a complete cron environment
 	install -d ${D}${localstatedir}/spool/cron
 	install -m 0755 ${WORKDIR}/crontab ${D}${sysconfdir}/
Signature · 1 line
1.7.9.5
#2 lore raw

Re: [PATCH 1/4] cronie: add systemd support

Quoted 1 line · Chen Qi

+EnvironmentFile=/etc/sysconfig/crond

should this be represented as ${sysconfdir}/sysconfig/crond somehow instead

author
#3 lore raw

PATCH 2/4 bind: add systemd support

In reply to Chen Qi

Add systemd support for bind.

---
 .../bind/bind/generate-rndc-key.sh                 |    7 +++++++
 meta/recipes-connectivity/bind/bind/named.service  |   22 ++++++++++++++++++++
 meta/recipes-connectivity/bind/bind_9.9.5.bb       |   17 ++++++++++++++-
 3 files changed, 45 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-connectivity/bind/bind/generate-rndc-key.sh
 create mode 100644 meta/recipes-connectivity/bind/bind/named.service
meta/recipes-connectivity/bind/bind/generate-rndc-key.sh new file +7 -0
new file mode 100644
index 0000000..c2e88bf
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+if [ ! -s /etc/bind/rndc.key ]; then
+    echo -n "Generating /etc/bind/rndc.key:"
+    /usr/sbin/rndc-confgen -a -b 512 -r /dev/urandom
+    chown 0640 /etc/bind/rndc.key
+fi
meta/recipes-connectivity/bind/bind/named.service new file +22 -0
new file mode 100644
index 0000000..1792e41
@@ -0,0 +1,22 @@
+[Unit]
+Description=Berkeley Internet Name Domain (DNS)
+Wants=nss-lookup.target
+Before=nss-lookup.target
+After=network.target
+
+[Service]
+Type=forking
+EnvironmentFile=-/etc/sysconfig/named
+PIDFile=/run/named/named.pid
+
+ExecStartPre=@SBINDIR@/generate-rndc-key.sh
+ExecStart=@SBINDIR@/named $OPTIONS
+
+ExecReload=@BASE_BINDIR@/sh -c '@SBINDIR@/rndc reload > /dev/null 2>&1 || @BASE_BINDIR@/kill -HUP $MAINPID'
+
+ExecStop=@BASE_BINDIR@/sh -c '@SBINDIR@/rndc stop > /dev/null 2>&1 || @BASE_BINDIR@/kill -TERM $MAINPID'
+
+PrivateTmp=true
+
+[Install]
+WantedBy=multi-user.target
meta/recipes-connectivity/bind/bind_9.9.5.bb +16 -1
index 604deb6..053c352 100644
@@ -13,6 +13,8 @@ SRC_URI = "ftp://ftp.isc.org/isc/bind9/${PV}/${BPN}-${PV}.tar.gz \
            file://make-etc-initd-bind-stop-work.patch \
            file://mips1-not-support-opcode.diff \
            file://dont-test-on-host.patch \
+           file://generate-rndc-key.sh \
+           file://named.service \
 	   "
 
 SRC_URI[md5sum] = "e676c65cad5234617ee22f48e328c24e"
@@ -27,11 +29,13 @@ EXTRA_OECONF = " ${ENABLE_IPV6} --with-randomdev=/dev/random --disable-threads \
                  --with-openssl=${STAGING_LIBDIR}/.. --with-libxml2=${STAGING_LIBDIR}/.. \
                  --enable-exportlib --with-export-includedir=${includedir} --with-export-libdir=${libdir} \
                "
-inherit autotools-brokensep update-rc.d
+inherit autotools-brokensep update-rc.d systemd
 
 INITSCRIPT_NAME = "bind"
 INITSCRIPT_PARAMS = "defaults"
 
+SYSTEMD_SERVICE_${PN} = "named.service"
+
 PARALLEL_MAKE = ""
 
 RDEPENDS_${PN} = "python-core"
@@ -39,6 +43,7 @@ RDEPENDS_${PN} = "python-core"
 PACKAGES_prepend = " ${PN}-utils "
 FILES_${PN}-utils = "${bindir}/host ${bindir}/dig"
 FILES_${PN}-dev += "${bindir}/isc-config.h"
+FILES_${PN} += "${sbindir}/generate-rndc-key.sh"
 
 do_install_append() {
 	rm "${D}${bindir}/nslookup"
@@ -50,6 +55,16 @@ do_install_append() {
 	install -m 644 ${S}/conf/* "${D}${sysconfdir}/bind/"
 	install -m 755 "${S}/init.d" "${D}${sysconfdir}/init.d/bind"
 	sed -i -e '1s,#!.*python,#! /usr/bin/env python,' ${D}${sbindir}/dnssec-coverage ${D}${sbindir}/dnssec-checkds
+
+	# Install systemd related files
+	install -d ${D}${localstatedir}/cache/bind
+	install -d ${D}${sbindir}
+	install -m 755 ${WORKDIR}/generate-rndc-key.sh ${D}${sbindir}
+	install -d ${D}${systemd_unitdir}/system
+	install -m 0644 ${WORKDIR}/named.service ${D}${systemd_unitdir}/system
+	sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \
+	       -e 's,@SBINDIR@,${sbindir},g' \
+	       ${D}${systemd_unitdir}/system/named.service
 }
 
 CONFFILES_${PN} = " \
Signature · 1 line
1.7.9.5
author
#4 lore raw

Re: [PATCH 2/4] bind: add systemd support

Hi all,

In generate-rndc-key.sh, I should use chmod' instead of chown'. Sorry for my mistake.
I'll send out a V2 for this patch.

//Chen Qi

Quoted 105 lines · Chen Qi

Add systemd support for bind.

---
  .../bind/bind/generate-rndc-key.sh                 |    7 +++++++
  meta/recipes-connectivity/bind/bind/named.service  |   22 ++++++++++++++++++++
  meta/recipes-connectivity/bind/bind_9.9.5.bb       |   17 ++++++++++++++-
  3 files changed, 45 insertions(+), 1 deletion(-)

create mode 100644 meta/recipes-connectivity/bind/bind/generate-rndc-key.sh create mode 100644 meta/recipes-connectivity/bind/bind/named.service

meta/recipes-connectivity/bind/bind/generate-rndc-key.sh new file +7 -0
new file mode 100644
index 0000000..c2e88bf
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+if [ ! -s /etc/bind/rndc.key ]; then
+    echo -n "Generating /etc/bind/rndc.key:"
+    /usr/sbin/rndc-confgen -a -b 512 -r /dev/urandom
+    chown 0640 /etc/bind/rndc.key
+fi
meta/recipes-connectivity/bind/bind/named.service new file +22 -0
new file mode 100644
index 0000000..1792e41
@@ -0,0 +1,22 @@
+[Unit]
+Description=Berkeley Internet Name Domain (DNS)
+Wants=nss-lookup.target
+Before=nss-lookup.target
+After=network.target
+
+[Service]
+Type=forking
+EnvironmentFile=-/etc/sysconfig/named
+PIDFile=/run/named/named.pid
+
+ExecStartPre=@SBINDIR@/generate-rndc-key.sh
+ExecStart=@SBINDIR@/named $OPTIONS
+
+ExecReload=@BASE_BINDIR@/sh -c '@SBINDIR@/rndc reload > /dev/null 2>&1 || @BASE_BINDIR@/kill -HUP $MAINPID'
+
+ExecStop=@BASE_BINDIR@/sh -c '@SBINDIR@/rndc stop > /dev/null 2>&1 || @BASE_BINDIR@/kill -TERM $MAINPID'
+
+PrivateTmp=true
+
+[Install]
+WantedBy=multi-user.target
meta/recipes-connectivity/bind/bind_9.9.5.bb +16 -1
index 604deb6..053c352 100644
@@ -13,6 +13,8 @@ SRC_URI = "ftp://ftp.isc.org/isc/bind9/${PV}/${BPN}-${PV}.tar.gz \
             file://make-etc-initd-bind-stop-work.patch \
             file://mips1-not-support-opcode.diff \
             file://dont-test-on-host.patch \
+           file://generate-rndc-key.sh \
+           file://named.service \
  	   "
 
  SRC_URI[md5sum] = "e676c65cad5234617ee22f48e328c24e"
@@ -27,11 +29,13 @@ EXTRA_OECONF = " ${ENABLE_IPV6} --with-randomdev=/dev/random --disable-threads \
                   --with-openssl=${STAGING_LIBDIR}/.. --with-libxml2=${STAGING_LIBDIR}/.. \
                   --enable-exportlib --with-export-includedir=${includedir} --with-export-libdir=${libdir} \
                 "
-inherit autotools-brokensep update-rc.d
+inherit autotools-brokensep update-rc.d systemd
 
  INITSCRIPT_NAME = "bind"
  INITSCRIPT_PARAMS = "defaults"
 
+SYSTEMD_SERVICE_${PN} = "named.service"
+
  PARALLEL_MAKE = ""
 
  RDEPENDS_${PN} = "python-core"
@@ -39,6 +43,7 @@ RDEPENDS_${PN} = "python-core"
  PACKAGES_prepend = " ${PN}-utils "
  FILES_${PN}-utils = "${bindir}/host ${bindir}/dig"
  FILES_${PN}-dev += "${bindir}/isc-config.h"
+FILES_${PN} += "${sbindir}/generate-rndc-key.sh"
 
  do_install_append() {
  	rm "${D}${bindir}/nslookup"
@@ -50,6 +55,16 @@ do_install_append() {
  	install -m 644 ${S}/conf/* "${D}${sysconfdir}/bind/"
  	install -m 755 "${S}/init.d" "${D}${sysconfdir}/init.d/bind"
  	sed -i -e '1s,#!.*python,#! /usr/bin/env python,' ${D}${sbindir}/dnssec-coverage ${D}${sbindir}/dnssec-checkds
+
+	# Install systemd related files
+	install -d ${D}${localstatedir}/cache/bind
+	install -d ${D}${sbindir}
+	install -m 755 ${WORKDIR}/generate-rndc-key.sh ${D}${sbindir}
+	install -d ${D}${systemd_unitdir}/system
+	install -m 0644 ${WORKDIR}/named.service ${D}${systemd_unitdir}/system
+	sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \
+	       -e 's,@SBINDIR@,${sbindir},g' \
+	       ${D}${systemd_unitdir}/system/named.service
  }
 
  CONFFILES_${PN} = " \
author
#5 lore raw

PATCH 3/4 ppp: add systemd support

In reply to Chen Qi

Add systemd support for ppp.
The unit file mostly comes from ArchLinux.

---
 meta/recipes-connectivity/ppp/ppp/[email protected] |    9 +++++++++
 meta/recipes-connectivity/ppp/ppp_2.4.6.bb     |    9 +++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-connectivity/ppp/ppp/[email protected]
meta/recipes-connectivity/ppp/ppp/[email protected] new file +9 -0
new file mode 100644
index 0000000..2bf0b5e
@@ -0,0 +1,9 @@
+[Unit]
+Description=PPP link to %I
+Before=network.target
+
+[Service]
+ExecStart=@SBINDIR@/pppd call %I nodetach nolog
+
+[Install]
+WantedBy=multi-user.target
meta/recipes-connectivity/ppp/ppp_2.4.6.bb +7 -2
index b98abec..8bc3672 100644
@@ -28,12 +28,13 @@ SRC_URI = "http://ppp.samba.org/ftp/ppp/ppp-${PV}.tar.gz \
            file://ppp_on_boot \
            file://provider \
            file://0001-ppp-Fix-compilation-errors-in-Makefile.patch \
+           file://[email protected] \
 "
 
 SRC_URI[md5sum] = "3434d2cc9327167a0723aaaa8670083b"
 SRC_URI[sha256sum] = "1b33181a03962c8a092c055fb9980e9722728a8d98a4bb7ec7acda17c1b1b49d"
 
-inherit autotools-brokensep
+inherit autotools-brokensep systemd
 
 TARGET_CC_ARCH += " ${LDFLAGS}"
 EXTRA_OEMAKE = "STRIPPROG=${STRIP} MANDIR=${D}${datadir}/man/man8 INCDIR=${D}${includedir} LIBDIR=${D}${libdir}/pppd/${PV} BINDIR=${D}${sbindir}"
@@ -61,13 +62,17 @@ do_install_append () {
 	install -m 0755 ${WORKDIR}/pap ${D}${sysconfdir}/chatscripts
 	install -m 0755 ${WORKDIR}/ppp_on_boot ${D}${sysconfdir}/ppp/ppp_on_boot
 	install -m 0755 ${WORKDIR}/provider ${D}${sysconfdir}/ppp/peers/provider
+	install -d ${D}${systemd_unitdir}/system
+	install -m 0644 ${WORKDIR}/[email protected] ${D}${systemd_unitdir}/system
+	sed -i -e 's,@SBINDIR@,${sbindir},g' \
+	       ${D}${systemd_unitdir}/system/[email protected]
 	rm -rf ${D}/${mandir}/man8/man8
 	chmod u+s ${D}${sbindir}/pppd
 }
 
 CONFFILES_${PN} = "${sysconfdir}/ppp/pap-secrets ${sysconfdir}/ppp/chap-secrets ${sysconfdir}/ppp/options"
 PACKAGES =+ "${PN}-oa ${PN}-oe ${PN}-radius ${PN}-winbind ${PN}-minconn ${PN}-password ${PN}-l2tp ${PN}-tools"
-FILES_${PN}        = "${sysconfdir} ${bindir} ${sbindir}/chat ${sbindir}/pppd"
+FILES_${PN}        = "${sysconfdir} ${bindir} ${sbindir}/chat ${sbindir}/pppd ${systemd_unitdir}/system/[email protected]"
 FILES_${PN}-dbg += "${libdir}/pppd/${PV}/.debug"
 FILES_${PN}-oa       = "${libdir}/pppd/${PV}/pppoatm.so"
 FILES_${PN}-oe       = "${sbindir}/pppoe-discovery ${libdir}/pppd/${PV}/rp-pppoe.so"
Signature · 1 line
1.7.9.5
author
#6 lore raw

PATCH 4/4 tcf-agent: add systemd support

In reply to Chen Qi

Add systemd unit file tcf-agent.service.

---
 .../tcf-agent/tcf-agent/tcf-agent.service          |   10 ++++++++++
 meta/recipes-devtools/tcf-agent/tcf-agent_git.bb   |    8 +++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-devtools/tcf-agent/tcf-agent/tcf-agent.service
meta/recipes-devtools/tcf-agent/tcf-agent/tcf-agent.service new file +10 -0
new file mode 100644
index 0000000..5d7a586
@@ -0,0 +1,10 @@
+[Unit]
+Description=Target Communication Framework agent
+After=network.target
+
+[Service]
+Type=forking
+ExecStart=@SBINDIR@/tcf-agent -d -L- -l0
+
+[Install]
+WantedBy=multi-user.target
\ No newline at end of file
meta/recipes-devtools/tcf-agent/tcf-agent_git.bb +7 -1
index 1eb0021..616a6a7 100644
@@ -12,6 +12,7 @@ PR = "r2"
 SRC_URI = "git://git.eclipse.org/gitroot/tcf/org.eclipse.tcf.agent.git \
            file://fix_ranlib.patch \
            file://tcf-agent.init \
+           file://tcf-agent.service \
           "
 
 DEPENDS = "util-linux openssl"
@@ -19,7 +20,9 @@ RDEPENDS_${PN} = "bash"
 
 S = "${WORKDIR}/git"
 
-inherit update-rc.d
+inherit update-rc.d systemd
+
+SYSTEMD_SERVICE_${PN} = "tcf-agent.service"
 
 INITSCRIPT_NAME = "tcf-agent"
 INITSCRIPT_PARAMS = "start 99 3 5 . stop 20 0 1 2 6 ."
@@ -44,5 +47,8 @@ do_install() {
 	oe_runmake install INSTALLROOT=${D}
 	install -d ${D}${sysconfdir}/init.d/
 	install -m 0755 ${WORKDIR}/tcf-agent.init ${D}${sysconfdir}/init.d/tcf-agent
+	install -d ${D}${systemd_unitdir}/system
+	install -m 0644 ${WORKDIR}/tcf-agent.service ${D}${systemd_unitdir}/system
+	sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/tcf-agent.service
 }
 
Signature · 1 line
1.7.9.5