* [PATCH] [v2] openssh: Enabling with systemd
@ 2013-07-11 7:45 Shakeel, Muhammad
2013-07-11 8:04 ` Muhammad Shakeel
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Shakeel, Muhammad @ 2013-07-11 7:45 UTC (permalink / raw)
To: openembedded-core
From: Muhammad Shakeel <muhammad_shakeel@mentor.com>
- Remove dependency on systemd layer
- Install 'sysv' related files only if distro has this feature
Signed-off-by: Muhammad Shakeel <muhammad_shakeel@mentor.com>
---
.../openssh/openssh-6.2p2/sshd.socket | 11 ++++++++
.../openssh/openssh-6.2p2/sshd@.service | 9 ++++++
.../openssh/openssh-6.2p2/sshdgenkeys.service | 10 +++++++
meta/recipes-connectivity/openssh/openssh_6.2p2.bb | 29 +++++++++++++++++---
4 files changed, 55 insertions(+), 4 deletions(-)
diff --git a/meta/recipes-connectivity/openssh/openssh-6.2p2/sshd.socket b/meta/recipes-connectivity/openssh/openssh-6.2p2/sshd.socket
new file mode 100644
index 0000000..753a33b
--- /dev/null
+++ b/meta/recipes-connectivity/openssh/openssh-6.2p2/sshd.socket
@@ -0,0 +1,11 @@
+[Unit]
+Conflicts=sshd.service
+
+[Socket]
+ExecStartPre=/bin/mkdir -p /var/run/sshd
+ListenStream=22
+Accept=yes
+
+[Install]
+WantedBy=sockets.target
+Also=sshdgenkeys.service
diff --git a/meta/recipes-connectivity/openssh/openssh-6.2p2/sshd@.service b/meta/recipes-connectivity/openssh/openssh-6.2p2/sshd@.service
new file mode 100644
index 0000000..d118490
--- /dev/null
+++ b/meta/recipes-connectivity/openssh/openssh-6.2p2/sshd@.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=OpenSSH Per-Connection Daemon
+After=sshdgenkeys.service
+
+[Service]
+ExecStart=-/usr/sbin/sshd -i
+ExecReload=/bin/kill -HUP $MAINPID
+StandardInput=socket
+StandardError=syslog
diff --git a/meta/recipes-connectivity/openssh/openssh-6.2p2/sshdgenkeys.service b/meta/recipes-connectivity/openssh/openssh-6.2p2/sshdgenkeys.service
new file mode 100644
index 0000000..c717214
--- /dev/null
+++ b/meta/recipes-connectivity/openssh/openssh-6.2p2/sshdgenkeys.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=SSH Key Generation
+
+[Service]
+ExecStart=/usr/bin/ssh-keygen -A
+Type=oneshot
+RemainAfterExit=yes
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta/recipes-connectivity/openssh/openssh_6.2p2.bb b/meta/recipes-connectivity/openssh/openssh_6.2p2.bb
index ab2eefb..b9657d5 100644
--- a/meta/recipes-connectivity/openssh/openssh_6.2p2.bb
+++ b/meta/recipes-connectivity/openssh/openssh_6.2p2.bb
@@ -26,14 +26,17 @@ SRC_URI = "ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-${PV}.tar.
file://init \
file://openssh-CVE-2011-4327.patch \
file://mac.patch \
- ${@base_contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)}"
+ ${@base_contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)} \
+ file://sshd.socket \
+ file://sshd@.service \
+ file://sshdgenkeys.service "
PAM_SRC_URI = "file://sshd"
SRC_URI[md5sum] = "be46174dcbb77ebb4ea88ef140685de1"
SRC_URI[sha256sum] = "7f29b9d2ad672ae0f9e1dcbff871fc5c2e60a194e90c766432e32161b842313b"
-inherit useradd update-rc.d update-alternatives
+inherit useradd update-rc.d update-alternatives systemd
USERADD_PACKAGES = "${PN}-sshd"
USERADD_PARAM_${PN}-sshd = "--system --no-create-home --home-dir /var/run/sshd --shell /bin/false --user-group sshd"
@@ -41,6 +44,10 @@ INITSCRIPT_PACKAGES = "${PN}-sshd"
INITSCRIPT_NAME_${PN}-sshd = "sshd"
INITSCRIPT_PARAMS_${PN}-sshd = "defaults 9"
+SYSTEMD_PACKAGES = "${PN}-sshd"
+SYSTEMD_SERVICE_${PN}-sshd = "sshd.socket"
+SYSTEMD_AUTO_ENABLE = "enable"
+
PACKAGECONFIG ??= "tcp-wrappers"
PACKAGECONFIG[tcp-wrappers] = "--with-tcp-wrappers,,tcp-wrappers"
@@ -82,8 +89,21 @@ do_install_append () {
install -m 0755 ${WORKDIR}/sshd ${D}${sysconfdir}/pam.d/sshd
fi
done
- install -d ${D}${sysconfdir}/init.d
- install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/sshd
+
+ if ${@base_contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
+ install -d ${D}${sysconfdir}/init.d
+ install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/sshd
+ fi
+
+ if ${@base_contains('DISTRO_FEATURES','systemd','true','false',d)}; then
+ install -d ${D}${systemd_unitdir}/system
+ install -m 0644 ${WORKDIR}/sshd.socket ${D}${systemd_unitdir}/system
+ install -m 0644 ${WORKDIR}/sshd@.service ${D}${systemd_unitdir}/system
+ install -m 0644 ${WORKDIR}/sshdgenkeys.service ${D}${systemd_unitdir}/system
+ sed -i 's,/usr/sbin/,${sbindir}/,g' ${D}${systemd_unitdir}/system/sshd@.service
+ sed -i 's,/usr/bin/,${bindir}/,g' ${D}${systemd_unitdir}/system/sshdgenkeys.service
+ fi
+
rm -f ${D}${bindir}/slogin ${D}${datadir}/Ssh.bin
rmdir ${D}${localstatedir}/run/sshd ${D}${localstatedir}/run ${D}${localstatedir}
}
@@ -95,6 +115,7 @@ FILES_${PN}-scp = "${bindir}/scp.${BPN}"
FILES_${PN}-ssh = "${bindir}/ssh.${BPN} ${sysconfdir}/ssh/ssh_config"
FILES_${PN}-sshd = "${sbindir}/sshd ${sysconfdir}/init.d/sshd"
FILES_${PN}-sshd += "${sysconfdir}/ssh/moduli ${sysconfdir}/ssh/sshd_config"
+FILES_${PN}-sshd += "${systemd_unitdir}"
FILES_${PN}-sftp = "${bindir}/sftp"
FILES_${PN}-sftp-server = "${libexecdir}/sftp-server"
FILES_${PN}-misc = "${bindir}/ssh* ${libexecdir}/ssh*"
--
1.7.9.5
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH] [v2] openssh: Enabling with systemd
2013-07-11 7:45 [PATCH] [v2] openssh: Enabling with systemd Shakeel, Muhammad
@ 2013-07-11 8:04 ` Muhammad Shakeel
2013-07-11 8:23 ` Martin Jansa
2013-07-11 18:03 ` Saul Wold
2 siblings, 0 replies; 10+ messages in thread
From: Muhammad Shakeel @ 2013-07-11 8:04 UTC (permalink / raw)
To: openembedded-core
[-- Attachment #1: Type: text/plain, Size: 597 bytes --]
On 07/11/2013 12:45 PM, Shakeel, Muhammad wrote:
> +++ b/meta/recipes-connectivity/openssh/openssh-6.2p2/sshd.socket
> @@ -0,0 +1,11 @@
> +[Unit]
> +Conflicts=sshd.service
|sshd.service is the ||service file for running a single SSH server for
all incoming connections, suitable only for systems with a large amount
of SSH traffic. ||In almost all other cases it is a better idea to use
sshd.socket + sshd@.service (i.e. the on-demand spawning version for one
instance per connection). In case these both are present, there will be
a conflict and systemd should be aware of it.
|
[-- Attachment #2: Type: text/html, Size: 1130 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] [v2] openssh: Enabling with systemd
2013-07-11 7:45 [PATCH] [v2] openssh: Enabling with systemd Shakeel, Muhammad
2013-07-11 8:04 ` Muhammad Shakeel
@ 2013-07-11 8:23 ` Martin Jansa
2013-07-11 9:55 ` Shakeel, Muhammad
2013-07-11 18:03 ` Saul Wold
2 siblings, 1 reply; 10+ messages in thread
From: Martin Jansa @ 2013-07-11 8:23 UTC (permalink / raw)
To: Shakeel, Muhammad; +Cc: openembedded-core
[-- Attachment #1: Type: text/plain, Size: 484 bytes --]
On Thu, Jul 11, 2013 at 12:45:28PM +0500, Shakeel, Muhammad wrote:
> From: Muhammad Shakeel <muhammad_shakeel@mentor.com>
>
> - Remove dependency on systemd layer
> - Install 'sysv' related files only if distro has this feature
Will you please send .bbappend removal patches for meta-systemd layer
when your changes in oe-core are applied? That way I don't need to keep
track of what was moved already. Thanks
--
Martin 'JaMa' Jansa jabber: Martin.Jansa@gmail.com
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 205 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] [v2] openssh: Enabling with systemd
2013-07-11 7:45 [PATCH] [v2] openssh: Enabling with systemd Shakeel, Muhammad
2013-07-11 8:04 ` Muhammad Shakeel
2013-07-11 8:23 ` Martin Jansa
@ 2013-07-11 18:03 ` Saul Wold
2013-07-11 18:18 ` Ahsan, Noor
2 siblings, 1 reply; 10+ messages in thread
From: Saul Wold @ 2013-07-11 18:03 UTC (permalink / raw)
To: Shakeel, Muhammad; +Cc: openembedded-core
On 07/11/2013 12:45 AM, Shakeel, Muhammad wrote:
> From: Muhammad Shakeel <muhammad_shakeel@mentor.com>
>
> - Remove dependency on systemd layer
> - Install 'sysv' related files only if distro has this feature
>
Seeing all these changes has me thinking we really need to support this
correctly in the systemd and maybe a new sysvinit bbclass since you are
doing the same thing in multiple recipes, seems like the classes should
have some kind of do_install_append that operates on those files.
I guess this has been mentioned by JaMa on the oe-devel list, and Ross
might be looking into it, but he could use some help if you have time to
address the bbclass that would be very helpful.
See also: https://bugzilla.yoctoproject.org/show_bug.cgi?id=4309
I am going to hold off taking any more of these systemd patches until we
get this sorted out.
Thanks
Sau!
> Signed-off-by: Muhammad Shakeel <muhammad_shakeel@mentor.com>
> ---
> .../openssh/openssh-6.2p2/sshd.socket | 11 ++++++++
> .../openssh/openssh-6.2p2/sshd@.service | 9 ++++++
> .../openssh/openssh-6.2p2/sshdgenkeys.service | 10 +++++++
> meta/recipes-connectivity/openssh/openssh_6.2p2.bb | 29 +++++++++++++++++---
> 4 files changed, 55 insertions(+), 4 deletions(-)
>
> diff --git a/meta/recipes-connectivity/openssh/openssh-6.2p2/sshd.socket b/meta/recipes-connectivity/openssh/openssh-6.2p2/sshd.socket
> new file mode 100644
> index 0000000..753a33b
> --- /dev/null
> +++ b/meta/recipes-connectivity/openssh/openssh-6.2p2/sshd.socket
> @@ -0,0 +1,11 @@
> +[Unit]
> +Conflicts=sshd.service
> +
> +[Socket]
> +ExecStartPre=/bin/mkdir -p /var/run/sshd
> +ListenStream=22
> +Accept=yes
> +
> +[Install]
> +WantedBy=sockets.target
> +Also=sshdgenkeys.service
> diff --git a/meta/recipes-connectivity/openssh/openssh-6.2p2/sshd@.service b/meta/recipes-connectivity/openssh/openssh-6.2p2/sshd@.service
> new file mode 100644
> index 0000000..d118490
> --- /dev/null
> +++ b/meta/recipes-connectivity/openssh/openssh-6.2p2/sshd@.service
> @@ -0,0 +1,9 @@
> +[Unit]
> +Description=OpenSSH Per-Connection Daemon
> +After=sshdgenkeys.service
> +
> +[Service]
> +ExecStart=-/usr/sbin/sshd -i
> +ExecReload=/bin/kill -HUP $MAINPID
> +StandardInput=socket
> +StandardError=syslog
> diff --git a/meta/recipes-connectivity/openssh/openssh-6.2p2/sshdgenkeys.service b/meta/recipes-connectivity/openssh/openssh-6.2p2/sshdgenkeys.service
> new file mode 100644
> index 0000000..c717214
> --- /dev/null
> +++ b/meta/recipes-connectivity/openssh/openssh-6.2p2/sshdgenkeys.service
> @@ -0,0 +1,10 @@
> +[Unit]
> +Description=SSH Key Generation
> +
> +[Service]
> +ExecStart=/usr/bin/ssh-keygen -A
> +Type=oneshot
> +RemainAfterExit=yes
> +
> +[Install]
> +WantedBy=multi-user.target
> diff --git a/meta/recipes-connectivity/openssh/openssh_6.2p2.bb b/meta/recipes-connectivity/openssh/openssh_6.2p2.bb
> index ab2eefb..b9657d5 100644
> --- a/meta/recipes-connectivity/openssh/openssh_6.2p2.bb
> +++ b/meta/recipes-connectivity/openssh/openssh_6.2p2.bb
> @@ -26,14 +26,17 @@ SRC_URI = "ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-${PV}.tar.
> file://init \
> file://openssh-CVE-2011-4327.patch \
> file://mac.patch \
> - ${@base_contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)}"
> + ${@base_contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)} \
> + file://sshd.socket \
> + file://sshd@.service \
> + file://sshdgenkeys.service "
>
> PAM_SRC_URI = "file://sshd"
>
> SRC_URI[md5sum] = "be46174dcbb77ebb4ea88ef140685de1"
> SRC_URI[sha256sum] = "7f29b9d2ad672ae0f9e1dcbff871fc5c2e60a194e90c766432e32161b842313b"
>
> -inherit useradd update-rc.d update-alternatives
> +inherit useradd update-rc.d update-alternatives systemd
>
> USERADD_PACKAGES = "${PN}-sshd"
> USERADD_PARAM_${PN}-sshd = "--system --no-create-home --home-dir /var/run/sshd --shell /bin/false --user-group sshd"
> @@ -41,6 +44,10 @@ INITSCRIPT_PACKAGES = "${PN}-sshd"
> INITSCRIPT_NAME_${PN}-sshd = "sshd"
> INITSCRIPT_PARAMS_${PN}-sshd = "defaults 9"
>
> +SYSTEMD_PACKAGES = "${PN}-sshd"
> +SYSTEMD_SERVICE_${PN}-sshd = "sshd.socket"
> +SYSTEMD_AUTO_ENABLE = "enable"
> +
> PACKAGECONFIG ??= "tcp-wrappers"
> PACKAGECONFIG[tcp-wrappers] = "--with-tcp-wrappers,,tcp-wrappers"
>
> @@ -82,8 +89,21 @@ do_install_append () {
> install -m 0755 ${WORKDIR}/sshd ${D}${sysconfdir}/pam.d/sshd
> fi
> done
> - install -d ${D}${sysconfdir}/init.d
> - install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/sshd
> +
> + if ${@base_contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
> + install -d ${D}${sysconfdir}/init.d
> + install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/sshd
> + fi
> +
> + if ${@base_contains('DISTRO_FEATURES','systemd','true','false',d)}; then
> + install -d ${D}${systemd_unitdir}/system
> + install -m 0644 ${WORKDIR}/sshd.socket ${D}${systemd_unitdir}/system
> + install -m 0644 ${WORKDIR}/sshd@.service ${D}${systemd_unitdir}/system
> + install -m 0644 ${WORKDIR}/sshdgenkeys.service ${D}${systemd_unitdir}/system
> + sed -i 's,/usr/sbin/,${sbindir}/,g' ${D}${systemd_unitdir}/system/sshd@.service
> + sed -i 's,/usr/bin/,${bindir}/,g' ${D}${systemd_unitdir}/system/sshdgenkeys.service
> + fi
> +
> rm -f ${D}${bindir}/slogin ${D}${datadir}/Ssh.bin
> rmdir ${D}${localstatedir}/run/sshd ${D}${localstatedir}/run ${D}${localstatedir}
> }
> @@ -95,6 +115,7 @@ FILES_${PN}-scp = "${bindir}/scp.${BPN}"
> FILES_${PN}-ssh = "${bindir}/ssh.${BPN} ${sysconfdir}/ssh/ssh_config"
> FILES_${PN}-sshd = "${sbindir}/sshd ${sysconfdir}/init.d/sshd"
> FILES_${PN}-sshd += "${sysconfdir}/ssh/moduli ${sysconfdir}/ssh/sshd_config"
> +FILES_${PN}-sshd += "${systemd_unitdir}"
> FILES_${PN}-sftp = "${bindir}/sftp"
> FILES_${PN}-sftp-server = "${libexecdir}/sftp-server"
> FILES_${PN}-misc = "${bindir}/ssh* ${libexecdir}/ssh*"
>
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] [v2] openssh: Enabling with systemd
2013-07-11 18:03 ` Saul Wold
@ 2013-07-11 18:18 ` Ahsan, Noor
2013-07-11 18:32 ` Saul Wold
0 siblings, 1 reply; 10+ messages in thread
From: Ahsan, Noor @ 2013-07-11 18:18 UTC (permalink / raw)
To: Saul Wold; +Cc: openembedded-core@lists.openembedded.org
We are seeing different checks for different recipes. Do you guys think that it is possible to handle them in bbclass.
Noor
On Jul 11, 2013, at 23:04, "Saul Wold" <sgw@linux.intel.com> wrote:
> On 07/11/2013 12:45 AM, Shakeel, Muhammad wrote:
>> From: Muhammad Shakeel <muhammad_shakeel@mentor.com>
>>
>> - Remove dependency on systemd layer
>> - Install 'sysv' related files only if distro has this feature
>>
> Seeing all these changes has me thinking we really need to support this correctly in the systemd and maybe a new sysvinit bbclass since you are doing the same thing in multiple recipes, seems like the classes should have some kind of do_install_append that operates on those files.
>
> I guess this has been mentioned by JaMa on the oe-devel list, and Ross might be looking into it, but he could use some help if you have time to address the bbclass that would be very helpful.
>
> See also: https://bugzilla.yoctoproject.org/show_bug.cgi?id=4309
>
> I am going to hold off taking any more of these systemd patches until we get this sorted out.
>
>
> Thanks
> Sau!
>
>
>> Signed-off-by: Muhammad Shakeel <muhammad_shakeel@mentor.com>
>> ---
>> .../openssh/openssh-6.2p2/sshd.socket | 11 ++++++++
>> .../openssh/openssh-6.2p2/sshd@.service | 9 ++++++
>> .../openssh/openssh-6.2p2/sshdgenkeys.service | 10 +++++++
>> meta/recipes-connectivity/openssh/openssh_6.2p2.bb | 29 +++++++++++++++++---
>> 4 files changed, 55 insertions(+), 4 deletions(-)
>>
>> diff --git a/meta/recipes-connectivity/openssh/openssh-6.2p2/sshd.socket b/meta/recipes-connectivity/openssh/openssh-6.2p2/sshd.socket
>> new file mode 100644
>> index 0000000..753a33b
>> --- /dev/null
>> +++ b/meta/recipes-connectivity/openssh/openssh-6.2p2/sshd.socket
>> @@ -0,0 +1,11 @@
>> +[Unit]
>> +Conflicts=sshd.service
>> +
>> +[Socket]
>> +ExecStartPre=/bin/mkdir -p /var/run/sshd
>> +ListenStream=22
>> +Accept=yes
>> +
>> +[Install]
>> +WantedBy=sockets.target
>> +Also=sshdgenkeys.service
>> diff --git a/meta/recipes-connectivity/openssh/openssh-6.2p2/sshd@.service b/meta/recipes-connectivity/openssh/openssh-6.2p2/sshd@.service
>> new file mode 100644
>> index 0000000..d118490
>> --- /dev/null
>> +++ b/meta/recipes-connectivity/openssh/openssh-6.2p2/sshd@.service
>> @@ -0,0 +1,9 @@
>> +[Unit]
>> +Description=OpenSSH Per-Connection Daemon
>> +After=sshdgenkeys.service
>> +
>> +[Service]
>> +ExecStart=-/usr/sbin/sshd -i
>> +ExecReload=/bin/kill -HUP $MAINPID
>> +StandardInput=socket
>> +StandardError=syslog
>> diff --git a/meta/recipes-connectivity/openssh/openssh-6.2p2/sshdgenkeys.service b/meta/recipes-connectivity/openssh/openssh-6.2p2/sshdgenkeys.service
>> new file mode 100644
>> index 0000000..c717214
>> --- /dev/null
>> +++ b/meta/recipes-connectivity/openssh/openssh-6.2p2/sshdgenkeys.service
>> @@ -0,0 +1,10 @@
>> +[Unit]
>> +Description=SSH Key Generation
>> +
>> +[Service]
>> +ExecStart=/usr/bin/ssh-keygen -A
>> +Type=oneshot
>> +RemainAfterExit=yes
>> +
>> +[Install]
>> +WantedBy=multi-user.target
>> diff --git a/meta/recipes-connectivity/openssh/openssh_6.2p2.bb b/meta/recipes-connectivity/openssh/openssh_6.2p2.bb
>> index ab2eefb..b9657d5 100644
>> --- a/meta/recipes-connectivity/openssh/openssh_6.2p2.bb
>> +++ b/meta/recipes-connectivity/openssh/openssh_6.2p2.bb
>> @@ -26,14 +26,17 @@ SRC_URI = "ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-${PV}.tar.
>> file://init \
>> file://openssh-CVE-2011-4327.patch \
>> file://mac.patch \
>> - ${@base_contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)}"
>> + ${@base_contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)} \
>> + file://sshd.socket \
>> + file://sshd@.service \
>> + file://sshdgenkeys.service "
>>
>> PAM_SRC_URI = "file://sshd"
>>
>> SRC_URI[md5sum] = "be46174dcbb77ebb4ea88ef140685de1"
>> SRC_URI[sha256sum] = "7f29b9d2ad672ae0f9e1dcbff871fc5c2e60a194e90c766432e32161b842313b"
>>
>> -inherit useradd update-rc.d update-alternatives
>> +inherit useradd update-rc.d update-alternatives systemd
>>
>> USERADD_PACKAGES = "${PN}-sshd"
>> USERADD_PARAM_${PN}-sshd = "--system --no-create-home --home-dir /var/run/sshd --shell /bin/false --user-group sshd"
>> @@ -41,6 +44,10 @@ INITSCRIPT_PACKAGES = "${PN}-sshd"
>> INITSCRIPT_NAME_${PN}-sshd = "sshd"
>> INITSCRIPT_PARAMS_${PN}-sshd = "defaults 9"
>>
>> +SYSTEMD_PACKAGES = "${PN}-sshd"
>> +SYSTEMD_SERVICE_${PN}-sshd = "sshd.socket"
>> +SYSTEMD_AUTO_ENABLE = "enable"
>> +
>> PACKAGECONFIG ??= "tcp-wrappers"
>> PACKAGECONFIG[tcp-wrappers] = "--with-tcp-wrappers,,tcp-wrappers"
>>
>> @@ -82,8 +89,21 @@ do_install_append () {
>> install -m 0755 ${WORKDIR}/sshd ${D}${sysconfdir}/pam.d/sshd
>> fi
>> done
>> - install -d ${D}${sysconfdir}/init.d
>> - install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/sshd
>> +
>> + if ${@base_contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
>> + install -d ${D}${sysconfdir}/init.d
>> + install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/sshd
>> + fi
>> +
>> + if ${@base_contains('DISTRO_FEATURES','systemd','true','false',d)}; then
>> + install -d ${D}${systemd_unitdir}/system
>> + install -m 0644 ${WORKDIR}/sshd.socket ${D}${systemd_unitdir}/system
>> + install -m 0644 ${WORKDIR}/sshd@.service ${D}${systemd_unitdir}/system
>> + install -m 0644 ${WORKDIR}/sshdgenkeys.service ${D}${systemd_unitdir}/system
>> + sed -i 's,/usr/sbin/,${sbindir}/,g' ${D}${systemd_unitdir}/system/sshd@.service
>> + sed -i 's,/usr/bin/,${bindir}/,g' ${D}${systemd_unitdir}/system/sshdgenkeys.service
>> + fi
>> +
>> rm -f ${D}${bindir}/slogin ${D}${datadir}/Ssh.bin
>> rmdir ${D}${localstatedir}/run/sshd ${D}${localstatedir}/run ${D}${localstatedir}
>> }
>> @@ -95,6 +115,7 @@ FILES_${PN}-scp = "${bindir}/scp.${BPN}"
>> FILES_${PN}-ssh = "${bindir}/ssh.${BPN} ${sysconfdir}/ssh/ssh_config"
>> FILES_${PN}-sshd = "${sbindir}/sshd ${sysconfdir}/init.d/sshd"
>> FILES_${PN}-sshd += "${sysconfdir}/ssh/moduli ${sysconfdir}/ssh/sshd_config"
>> +FILES_${PN}-sshd += "${systemd_unitdir}"
>> FILES_${PN}-sftp = "${bindir}/sftp"
>> FILES_${PN}-sftp-server = "${libexecdir}/sftp-server"
>> FILES_${PN}-misc = "${bindir}/ssh* ${libexecdir}/ssh*"
>>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] [v2] openssh: Enabling with systemd
2013-07-11 18:18 ` Ahsan, Noor
@ 2013-07-11 18:32 ` Saul Wold
2013-07-12 16:32 ` Burton, Ross
0 siblings, 1 reply; 10+ messages in thread
From: Saul Wold @ 2013-07-11 18:32 UTC (permalink / raw)
To: Ahsan, Noor; +Cc: openembedded-core@lists.openembedded.org
On 07/11/2013 11:18 AM, Ahsan, Noor wrote:
> We are seeing different checks for different recipes. Do you guys think that it is possible to handle them in bbclass.
>
How different are they, there is the DISTRO_FEATURE check and then
typically the service file or the init file is sed'ed and installed.
We can cover the common cases and then just have a few outsiders.
Can you detail what the different checks and installs are?
Sau!
> Noor
>
>
> Sent from my iPhone
>
> On Jul 11, 2013, at 23:04, "Saul Wold" <sgw@linux.intel.com> wrote:
>
>> On 07/11/2013 12:45 AM, Shakeel, Muhammad wrote:
>>> From: Muhammad Shakeel <muhammad_shakeel@mentor.com>
>>>
>>> - Remove dependency on systemd layer
>>> - Install 'sysv' related files only if distro has this feature
>>>
>> Seeing all these changes has me thinking we really need to support this correctly in the systemd and maybe a new sysvinit bbclass since you are doing the same thing in multiple recipes, seems like the classes should have some kind of do_install_append that operates on those files.
>>
>> I guess this has been mentioned by JaMa on the oe-devel list, and Ross might be looking into it, but he could use some help if you have time to address the bbclass that would be very helpful.
>>
>> See also: https://bugzilla.yoctoproject.org/show_bug.cgi?id=4309
>>
>> I am going to hold off taking any more of these systemd patches until we get this sorted out.
>>
>>
>> Thanks
>> Sau!
>>
>>
>>> Signed-off-by: Muhammad Shakeel <muhammad_shakeel@mentor.com>
>>> ---
>>> .../openssh/openssh-6.2p2/sshd.socket | 11 ++++++++
>>> .../openssh/openssh-6.2p2/sshd@.service | 9 ++++++
>>> .../openssh/openssh-6.2p2/sshdgenkeys.service | 10 +++++++
>>> meta/recipes-connectivity/openssh/openssh_6.2p2.bb | 29 +++++++++++++++++---
>>> 4 files changed, 55 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/meta/recipes-connectivity/openssh/openssh-6.2p2/sshd.socket b/meta/recipes-connectivity/openssh/openssh-6.2p2/sshd.socket
>>> new file mode 100644
>>> index 0000000..753a33b
>>> --- /dev/null
>>> +++ b/meta/recipes-connectivity/openssh/openssh-6.2p2/sshd.socket
>>> @@ -0,0 +1,11 @@
>>> +[Unit]
>>> +Conflicts=sshd.service
>>> +
>>> +[Socket]
>>> +ExecStartPre=/bin/mkdir -p /var/run/sshd
>>> +ListenStream=22
>>> +Accept=yes
>>> +
>>> +[Install]
>>> +WantedBy=sockets.target
>>> +Also=sshdgenkeys.service
>>> diff --git a/meta/recipes-connectivity/openssh/openssh-6.2p2/sshd@.service b/meta/recipes-connectivity/openssh/openssh-6.2p2/sshd@.service
>>> new file mode 100644
>>> index 0000000..d118490
>>> --- /dev/null
>>> +++ b/meta/recipes-connectivity/openssh/openssh-6.2p2/sshd@.service
>>> @@ -0,0 +1,9 @@
>>> +[Unit]
>>> +Description=OpenSSH Per-Connection Daemon
>>> +After=sshdgenkeys.service
>>> +
>>> +[Service]
>>> +ExecStart=-/usr/sbin/sshd -i
>>> +ExecReload=/bin/kill -HUP $MAINPID
>>> +StandardInput=socket
>>> +StandardError=syslog
>>> diff --git a/meta/recipes-connectivity/openssh/openssh-6.2p2/sshdgenkeys.service b/meta/recipes-connectivity/openssh/openssh-6.2p2/sshdgenkeys.service
>>> new file mode 100644
>>> index 0000000..c717214
>>> --- /dev/null
>>> +++ b/meta/recipes-connectivity/openssh/openssh-6.2p2/sshdgenkeys.service
>>> @@ -0,0 +1,10 @@
>>> +[Unit]
>>> +Description=SSH Key Generation
>>> +
>>> +[Service]
>>> +ExecStart=/usr/bin/ssh-keygen -A
>>> +Type=oneshot
>>> +RemainAfterExit=yes
>>> +
>>> +[Install]
>>> +WantedBy=multi-user.target
>>> diff --git a/meta/recipes-connectivity/openssh/openssh_6.2p2.bb b/meta/recipes-connectivity/openssh/openssh_6.2p2.bb
>>> index ab2eefb..b9657d5 100644
>>> --- a/meta/recipes-connectivity/openssh/openssh_6.2p2.bb
>>> +++ b/meta/recipes-connectivity/openssh/openssh_6.2p2.bb
>>> @@ -26,14 +26,17 @@ SRC_URI = "ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-${PV}.tar.
>>> file://init \
>>> file://openssh-CVE-2011-4327.patch \
>>> file://mac.patch \
>>> - ${@base_contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)}"
>>> + ${@base_contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)} \
>>> + file://sshd.socket \
>>> + file://sshd@.service \
>>> + file://sshdgenkeys.service "
>>>
>>> PAM_SRC_URI = "file://sshd"
>>>
>>> SRC_URI[md5sum] = "be46174dcbb77ebb4ea88ef140685de1"
>>> SRC_URI[sha256sum] = "7f29b9d2ad672ae0f9e1dcbff871fc5c2e60a194e90c766432e32161b842313b"
>>>
>>> -inherit useradd update-rc.d update-alternatives
>>> +inherit useradd update-rc.d update-alternatives systemd
>>>
>>> USERADD_PACKAGES = "${PN}-sshd"
>>> USERADD_PARAM_${PN}-sshd = "--system --no-create-home --home-dir /var/run/sshd --shell /bin/false --user-group sshd"
>>> @@ -41,6 +44,10 @@ INITSCRIPT_PACKAGES = "${PN}-sshd"
>>> INITSCRIPT_NAME_${PN}-sshd = "sshd"
>>> INITSCRIPT_PARAMS_${PN}-sshd = "defaults 9"
>>>
>>> +SYSTEMD_PACKAGES = "${PN}-sshd"
>>> +SYSTEMD_SERVICE_${PN}-sshd = "sshd.socket"
>>> +SYSTEMD_AUTO_ENABLE = "enable"
>>> +
>>> PACKAGECONFIG ??= "tcp-wrappers"
>>> PACKAGECONFIG[tcp-wrappers] = "--with-tcp-wrappers,,tcp-wrappers"
>>>
>>> @@ -82,8 +89,21 @@ do_install_append () {
>>> install -m 0755 ${WORKDIR}/sshd ${D}${sysconfdir}/pam.d/sshd
>>> fi
>>> done
>>> - install -d ${D}${sysconfdir}/init.d
>>> - install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/sshd
>>> +
>>> + if ${@base_contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
>>> + install -d ${D}${sysconfdir}/init.d
>>> + install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/sshd
>>> + fi
>>> +
>>> + if ${@base_contains('DISTRO_FEATURES','systemd','true','false',d)}; then
>>> + install -d ${D}${systemd_unitdir}/system
>>> + install -m 0644 ${WORKDIR}/sshd.socket ${D}${systemd_unitdir}/system
>>> + install -m 0644 ${WORKDIR}/sshd@.service ${D}${systemd_unitdir}/system
>>> + install -m 0644 ${WORKDIR}/sshdgenkeys.service ${D}${systemd_unitdir}/system
>>> + sed -i 's,/usr/sbin/,${sbindir}/,g' ${D}${systemd_unitdir}/system/sshd@.service
>>> + sed -i 's,/usr/bin/,${bindir}/,g' ${D}${systemd_unitdir}/system/sshdgenkeys.service
>>> + fi
>>> +
>>> rm -f ${D}${bindir}/slogin ${D}${datadir}/Ssh.bin
>>> rmdir ${D}${localstatedir}/run/sshd ${D}${localstatedir}/run ${D}${localstatedir}
>>> }
>>> @@ -95,6 +115,7 @@ FILES_${PN}-scp = "${bindir}/scp.${BPN}"
>>> FILES_${PN}-ssh = "${bindir}/ssh.${BPN} ${sysconfdir}/ssh/ssh_config"
>>> FILES_${PN}-sshd = "${sbindir}/sshd ${sysconfdir}/init.d/sshd"
>>> FILES_${PN}-sshd += "${sysconfdir}/ssh/moduli ${sysconfdir}/ssh/sshd_config"
>>> +FILES_${PN}-sshd += "${systemd_unitdir}"
>>> FILES_${PN}-sftp = "${bindir}/sftp"
>>> FILES_${PN}-sftp-server = "${libexecdir}/sftp-server"
>>> FILES_${PN}-misc = "${bindir}/ssh* ${libexecdir}/ssh*"
>>>
>> _______________________________________________
>> Openembedded-core mailing list
>> Openembedded-core@lists.openembedded.org
>> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>
>
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] [v2] openssh: Enabling with systemd
2013-07-11 18:32 ` Saul Wold
@ 2013-07-12 16:32 ` Burton, Ross
2013-07-15 11:42 ` Muhammad Shakeel
0 siblings, 1 reply; 10+ messages in thread
From: Burton, Ross @ 2013-07-12 16:32 UTC (permalink / raw)
To: Saul Wold; +Cc: openembedded-core@lists.openembedded.org
On 11 July 2013 19:32, Saul Wold <sgw@linux.intel.com> wrote:
>> We are seeing different checks for different recipes. Do you guys think
>> that it is possible to handle them in bbclass.
>>
> How different are they, there is the DISTRO_FEATURE check and then typically
> the service file or the init file is sed'ed and installed.
My initial thoughts were to keep it simple and have a
do_install_append() that deleted the sysvinit or systemd files
depending on DISTRO_FEATURES, leaving installing the files themselves
(from upstream, from a file, whatever) up to the recipe because that's
where the complications are.
Ross
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] [v2] openssh: Enabling with systemd
2013-07-12 16:32 ` Burton, Ross
@ 2013-07-15 11:42 ` Muhammad Shakeel
2013-07-17 12:27 ` Burton, Ross
0 siblings, 1 reply; 10+ messages in thread
From: Muhammad Shakeel @ 2013-07-15 11:42 UTC (permalink / raw)
To: Burton, Ross; +Cc: openembedded-core@lists.openembedded.org
[-- Attachment #1: Type: text/plain, Size: 2005 bytes --]
On 07/12/2013 09:32 PM, Burton, Ross wrote:
> On 11 July 2013 19:32, Saul Wold <sgw@linux.intel.com> wrote:
>>> We are seeing different checks for different recipes. Do you
>>> guys think that it is possible to handle them in bbclass.
>>>
>> How different are they, there is the DISTRO_FEATURE check and then
>> typically the service file or the init file is sed'ed and
>> installed.
>
> My initial thoughts were to keep it simple and have a
> do_install_append() that deleted the sysvinit or systemd files
> depending on DISTRO_FEATURES, leaving installing the files themselves
> (from upstream, from a file, whatever) up to the recipe because
> that's where the complications are.
We can also easily move 'sed' part to systemd class because we will only be
looking for all the service files in ${systemd_unitdir}, irrespective of
how these got installed.
I gave a little thought to move the installation part into the class and
there
can be a solution but probably little complicated. The neatest solution
would
be to define an another variable say 'SYSTEMD_SERVICE_FILES_{PN}'
which will hold the name of all the service files, need to be installed,
along
with their relative path from WORKDIR. We can check in systemd class
that if
${systemd_unitdir} is not present, means upstream hasn't installed
anything,
then install whatever is in 'SYSTEMD_SERVICE_FILES_{PN}'.
Other option is to reuse current 'SYSTEMD_SERVICE_${PN}' that lists the
service
files in the package but doesn't include the path of service files. If
we do not
want a new variable, which seems like a duplication, then we can add the
path
with the service files in this variable and tweak systemd class to
handle this in
current implementation. We will add the path only if service file to be
installed is
not present in WORKDIR but buried somewhere in the package source.
Please let me know of your thoughts about installation part.
Best Regards,
Shakeel
[-- Attachment #2: Type: text/html, Size: 2802 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] [v2] openssh: Enabling with systemd
2013-07-15 11:42 ` Muhammad Shakeel
@ 2013-07-17 12:27 ` Burton, Ross
0 siblings, 0 replies; 10+ messages in thread
From: Burton, Ross @ 2013-07-17 12:27 UTC (permalink / raw)
To: Muhammad Shakeel; +Cc: openembedded-core@lists.openembedded.org
Hi,
On 15 July 2013 12:42, Muhammad Shakeel <muhammad_shakeel@mentor.com> wrote:
> We can also easily move 'sed' part to systemd class because we will only be
> looking for all the service files in ${systemd_unitdir}, irrespective of
> how these got installed.
>
> I gave a little thought to move the installation part into the class and
> there
> can be a solution but probably little complicated. The neatest solution
> would
> be to define an another variable say 'SYSTEMD_SERVICE_FILES_{PN}'
> which will hold the name of all the service files, need to be installed,
> along
> with their relative path from WORKDIR. We can check in systemd class that if
> ${systemd_unitdir} is not present, means upstream hasn't installed anything,
> then install whatever is in 'SYSTEMD_SERVICE_FILES_{PN}'.
>
> Other option is to reuse current 'SYSTEMD_SERVICE_${PN}' that lists the
> service
> files in the package but doesn't include the path of service files. If we do
> not
> want a new variable, which seems like a duplication, then we can add the
> path
> with the service files in this variable and tweak systemd class to handle
> this in
> current implementation. We will add the path only if service file to be
> installed is
> not present in WORKDIR but buried somewhere in the package source.
Installation of unit files will only be used in packages that don't
ship their own, which will be reducing over time as more upstream
packages integrate the files, so I don't think it's worthwhile writing
some complicated logic for a diminishing need. I still think that
adding do_install_append() functions to systemd.bbclass and
update-rcd.bbclass to check the DISTRO_FEATURES and remove init
scripts as required would give us a lot more clarity in the recipes
without much "magic".
Ross
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2013-07-17 12:27 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-11 7:45 [PATCH] [v2] openssh: Enabling with systemd Shakeel, Muhammad
2013-07-11 8:04 ` Muhammad Shakeel
2013-07-11 8:23 ` Martin Jansa
2013-07-11 9:55 ` Shakeel, Muhammad
2013-07-11 18:03 ` Saul Wold
2013-07-11 18:18 ` Ahsan, Noor
2013-07-11 18:32 ` Saul Wold
2013-07-12 16:32 ` Burton, Ross
2013-07-15 11:42 ` Muhammad Shakeel
2013-07-17 12:27 ` Burton, Ross
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox