[OE-core] [PATCH] openssh: add systemd service file sshd.service
Li Xin
lixin.fnst at cn.fujitsu.com
Wed Mar 23 01:52:11 UTC 2016
If sysvinit is disabled from DISTRO_FEATURES,then /etc/init.d/sshd
will be removed,and this will cause sshd daemon failed to start by systemd,
So add it.
Signed-off-by: Li Xin <lixin.fnst at cn.fujitsu.com>
---
.../recipes-connectivity/openssh/openssh/sshd.service | 19 +++++++++++++++++++
meta/recipes-connectivity/openssh/openssh_7.1p2.bb | 9 +++++++--
2 files changed, 26 insertions(+), 2 deletions(-)
create mode 100644 meta/recipes-connectivity/openssh/openssh/sshd.service
diff --git a/meta/recipes-connectivity/openssh/openssh/sshd.service b/meta/recipes-connectivity/openssh/openssh/sshd.service
new file mode 100644
index 0000000..6c05f23
--- /dev/null
+++ b/meta/recipes-connectivity/openssh/openssh/sshd.service
@@ -0,0 +1,19 @@
+[Unit]
+Description=OpenSSH server daemon
+Documentation=man:sshd(8) man:sshd_config(5)
+After=network.target sshd-keygen.service
+Wants=sshd-keygen.service
+
+[Service]
+Type=forking
+PIDFile=@localstatedir@/run/sshd.pid
+EnvironmentFile=- at SYSCONFDIR@/sysconfig/sshd
+ExecStart=@SBINDIR@/sshd $OPTIONS
+ExecReload=@BASE_BINDIR@/kill -HUP $MAINPID
+KillMode=process
+Restart=on-failure
+RestartSec=42s
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/meta/recipes-connectivity/openssh/openssh_7.1p2.bb b/meta/recipes-connectivity/openssh/openssh_7.1p2.bb
index 3b5e28a..8b31b40 100644
--- a/meta/recipes-connectivity/openssh/openssh_7.1p2.bb
+++ b/meta/recipes-connectivity/openssh/openssh_7.1p2.bb
@@ -23,7 +23,9 @@ SRC_URI = "ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-${PV}.tar.
file://run-ptest \
file://CVE-2016-1907_upstream_commit.patch \
file://CVE-2016-1907_2.patch \
- file://CVE-2016-1907_3.patch "
+ file://CVE-2016-1907_3.patch \
+ file://sshd.service"
+
PAM_SRC_URI = "file://sshd"
@@ -39,7 +41,7 @@ INITSCRIPT_NAME_${PN}-sshd = "sshd"
INITSCRIPT_PARAMS_${PN}-sshd = "defaults 9"
SYSTEMD_PACKAGES = "${PN}-sshd"
-SYSTEMD_SERVICE_${PN}-sshd = "sshd.socket"
+SYSTEMD_SERVICE_${PN}-sshd = "sshd.socket sshd.service"
inherit autotools-brokensep ptest
@@ -118,9 +120,12 @@ do_install_append () {
install -c -m 0644 ${WORKDIR}/sshd.socket ${D}${systemd_unitdir}/system
install -c -m 0644 ${WORKDIR}/sshd at .service ${D}${systemd_unitdir}/system
install -c -m 0644 ${WORKDIR}/sshdgenkeys.service ${D}${systemd_unitdir}/system
+ install -c -m 0644 ${WORKDIR}/sshd.service ${D}${systemd_unitdir}/system
sed -i -e 's, at BASE_BINDIR@,${base_bindir},g' \
-e 's, at SBINDIR@,${sbindir},g' \
-e 's, at BINDIR@,${bindir},g' \
+ -e 's, at SYSCONFDIR@,${sysconfdir},g' \
+ -e 's, at localstatedir@,${localstatedir},g' \
${D}${systemd_unitdir}/system/sshd.socket ${D}${systemd_unitdir}/system/*.service
}
--
1.8.4.2
More information about the Openembedded-core
mailing list