Re: [OE-core] [PATCH v2] openssh: Add PACKAGECONFIG option to customize sshd mode

2023-12-06 Thread Yu, Mingli
Hi Peter,

Thanks very much for your comments!

Please use v4([OE-core] [PATCH v4] openssh: Add PACKAGECONFIG option to 
customize sshd mode) to track the series.

Thanks,

From: Peter Kjellerstedt 
Sent: Thursday, December 7, 2023 06:34
To: Yu, Mingli ; 
openembedded-core@lists.openembedded.org 

Subject: RE: [OE-core] [PATCH v2] openssh: Add PACKAGECONFIG option to 
customize sshd mode

CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know 
the content is safe.

> -Original Message-
> From: openembedded-core@lists.openembedded.org 
>  On Behalf Of Yu, Mingli
> Sent: den 5 december 2023 06:52
> To: openembedded-core@lists.openembedded.org
> Subject: [OE-core] [PATCH v2] openssh: Add PACKAGECONFIG option to customize 
> sshd mode
>
> From: Mingli Yu 
>
> Add systemd-sshd-socket-mode PACKAGECONFIG option to choose sshd.socket
> and systemd-sshd-service-mode PACKAGECONFIG option to choose installing
> sshd.service.
>
> The systemd-sshd-socket-mode PACKAGECONFIG option is enabled by default
> and user can customize the above two PACKAGECONFIG option to choose the
> sshd mode.
>
> Signed-off-by: Mingli Yu 
> ---
>  .../openssh/openssh_9.5p1.bb  | 24 ++-
>  1 file changed, 18 insertions(+), 6 deletions(-)
>
> diff --git a/meta/recipes-connectivity/openssh/openssh_9.5p1.bb 
> b/meta/recipes-connectivity/openssh/openssh_9.5p1.bb
> index bbb8fb091a..a10f5c5a61 100644
> --- a/meta/recipes-connectivity/openssh/openssh_9.5p1.bb
> +++ b/meta/recipes-connectivity/openssh/openssh_9.5p1.bb
> @@ -50,16 +50,20 @@ INITSCRIPT_NAME:${PN}-sshd = "sshd"
>  INITSCRIPT_PARAMS:${PN}-sshd = "defaults 9"
>
>  SYSTEMD_PACKAGES = "${PN}-sshd"
> -SYSTEMD_SERVICE:${PN}-sshd = "sshd.socket sshd.service"
> +SYSTEMD_SERVICE:${PN}-sshd = 
> "${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-socket-mode','sshd.socket',
>  '', d)} 
> ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-service-mode','sshd.service',
>  '', d)}"
>
>  inherit autotools-brokensep ptest pkgconfig
>  DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', 
> '', d)}"
>
> -PACKAGECONFIG ??= ""
> +# systemd-sshd-socket-mode means sshd.socket and systemd-sshd-service-mode
> +# corresponding to sshd.service
> +PACKAGECONFIG ??= " systemd-sshd-socket-mode"

Unnecessary leading space after the first quote.

>  PACKAGECONFIG[kerberos] = "--with-kerberos5,--without-kerberos5,krb5"
>  PACKAGECONFIG[ldns] = "--with-ldns,--without-ldns,ldns"
>  PACKAGECONFIG[libedit] = "--with-libedit,--without-libedit,libedit"
>  PACKAGECONFIG[manpages] = "--with-mantype=man,--with-mantype=cat"
> +PACKAGECONFIG[systemd-sshd-socket-mode] = ""
> +PACKAGECONFIG[systemd-sshd-service-mode] = ""
>
>  EXTRA_AUTORECONF += "--exclude=aclocal"
>
> @@ -125,15 +129,23 @@ do_install:append () {
>   echo "HostKey /var/run/ssh/ssh_host_ed25519_key" >> 
> ${D}${sysconfdir}/ssh/sshd_config_readonly
>
>   install -d ${D}${systemd_system_unitdir}
> - install -c -m 0644 ${WORKDIR}/sshd.socket ${D}${systemd_system_unitdir}
> - install -c -m 0644 ${WORKDIR}/sshd.service ${D}${systemd_system_unitdir}
> - install -c -m 0644 ${WORKDIR}/sshd@.service 
> ${D}${systemd_system_unitdir}
> + if 
> ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-socket-mode','true','false',d)};
>  then
> + install -c -m 0644 ${WORKDIR}/sshd.socket 
> ${D}${systemd_system_unitdir}
> + install -c -m 0644 ${WORKDIR}/sshd@.service 
> ${D}${systemd_system_unitdir}
> + sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \
> + -e 's,@SBINDIR@,${sbindir},g' \
> + -e 's,@BINDIR@,${bindir},g' \
> + -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \
> +${D}${systemd_system_unitdir}/sshd.socket

There is no need to duplicate the sed command here. The original
command below would take care of all the files that are actually
installed.

> + elif 
> ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-service-mode','true','false',d)};
>  then

Are the PACKAGECONFIGs mutually exclusive? The `elif` indicates
that this is the case. If so, they should be marked as mutually
exclusive by changing them to:

PACKAGECONFIG[systemd-sshd-socket-mode] = ", systemd-sshd-service-mode"
PACKAGECONFIG[systemd-sshd-service-mode] = ", systemd-sshd-socket-mode"

Alternatively, if it is useful to be able to install both the
sshd.socket file and the sshd.service file at the 

Re: [OE-core] [PATCH v2] openssh: Add PACKAGECONFIG option to customize sshd mode

2023-12-06 Thread Peter Kjellerstedt
> -Original Message-
> From: openembedded-core@lists.openembedded.org 
>  On Behalf Of Yu, Mingli
> Sent: den 5 december 2023 06:52
> To: openembedded-core@lists.openembedded.org
> Subject: [OE-core] [PATCH v2] openssh: Add PACKAGECONFIG option to customize 
> sshd mode
> 
> From: Mingli Yu 
> 
> Add systemd-sshd-socket-mode PACKAGECONFIG option to choose sshd.socket
> and systemd-sshd-service-mode PACKAGECONFIG option to choose installing
> sshd.service.
> 
> The systemd-sshd-socket-mode PACKAGECONFIG option is enabled by default
> and user can customize the above two PACKAGECONFIG option to choose the
> sshd mode.
> 
> Signed-off-by: Mingli Yu 
> ---
>  .../openssh/openssh_9.5p1.bb  | 24 ++-
>  1 file changed, 18 insertions(+), 6 deletions(-)
> 
> diff --git a/meta/recipes-connectivity/openssh/openssh_9.5p1.bb 
> b/meta/recipes-connectivity/openssh/openssh_9.5p1.bb
> index bbb8fb091a..a10f5c5a61 100644
> --- a/meta/recipes-connectivity/openssh/openssh_9.5p1.bb
> +++ b/meta/recipes-connectivity/openssh/openssh_9.5p1.bb
> @@ -50,16 +50,20 @@ INITSCRIPT_NAME:${PN}-sshd = "sshd"
>  INITSCRIPT_PARAMS:${PN}-sshd = "defaults 9"
> 
>  SYSTEMD_PACKAGES = "${PN}-sshd"
> -SYSTEMD_SERVICE:${PN}-sshd = "sshd.socket sshd.service"
> +SYSTEMD_SERVICE:${PN}-sshd = 
> "${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-socket-mode','sshd.socket',
>  '', d)} 
> ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-service-mode','sshd.service',
>  '', d)}"
> 
>  inherit autotools-brokensep ptest pkgconfig
>  DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', 
> '', d)}"
> 
> -PACKAGECONFIG ??= ""
> +# systemd-sshd-socket-mode means sshd.socket and systemd-sshd-service-mode
> +# corresponding to sshd.service
> +PACKAGECONFIG ??= " systemd-sshd-socket-mode"

Unnecessary leading space after the first quote.

>  PACKAGECONFIG[kerberos] = "--with-kerberos5,--without-kerberos5,krb5"
>  PACKAGECONFIG[ldns] = "--with-ldns,--without-ldns,ldns"
>  PACKAGECONFIG[libedit] = "--with-libedit,--without-libedit,libedit"
>  PACKAGECONFIG[manpages] = "--with-mantype=man,--with-mantype=cat"
> +PACKAGECONFIG[systemd-sshd-socket-mode] = ""
> +PACKAGECONFIG[systemd-sshd-service-mode] = ""
> 
>  EXTRA_AUTORECONF += "--exclude=aclocal"
> 
> @@ -125,15 +129,23 @@ do_install:append () {
>   echo "HostKey /var/run/ssh/ssh_host_ed25519_key" >> 
> ${D}${sysconfdir}/ssh/sshd_config_readonly
> 
>   install -d ${D}${systemd_system_unitdir}
> - install -c -m 0644 ${WORKDIR}/sshd.socket ${D}${systemd_system_unitdir}
> - install -c -m 0644 ${WORKDIR}/sshd.service ${D}${systemd_system_unitdir}
> - install -c -m 0644 ${WORKDIR}/sshd@.service 
> ${D}${systemd_system_unitdir}
> + if 
> ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-socket-mode','true','false',d)};
>  then
> + install -c -m 0644 ${WORKDIR}/sshd.socket 
> ${D}${systemd_system_unitdir}
> + install -c -m 0644 ${WORKDIR}/sshd@.service 
> ${D}${systemd_system_unitdir}
> + sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \
> + -e 's,@SBINDIR@,${sbindir},g' \
> + -e 's,@BINDIR@,${bindir},g' \
> + -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \
> +${D}${systemd_system_unitdir}/sshd.socket

There is no need to duplicate the sed command here. The original 
command below would take care of all the files that are actually 
installed.

> + elif 
> ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-service-mode','true','false',d)};
>  then

Are the PACKAGECONFIGs mutually exclusive? The `elif` indicates 
that this is the case. If so, they should be marked as mutually 
exclusive by changing them to:

PACKAGECONFIG[systemd-sshd-socket-mode] = ", systemd-sshd-service-mode"
PACKAGECONFIG[systemd-sshd-service-mode] = ", systemd-sshd-socket-mode"

Alternatively, if it is useful to be able to install both the 
sshd.socket file and the sshd.service file at the same time, then
the `elif` should be changed to a `fi` and an `if`.

> + install -c -m 0644 ${WORKDIR}/sshd.service 
> ${D}${systemd_system_unitdir}
> + fi
>   install -c -m 0644 ${WORKDIR}/sshdgenkeys.service 
> ${D}${systemd_system_unitdir}
>   sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \
>   -e 's,@SBINDIR@,${sbindir},g' \
>   -e 's,@BINDIR@,${bindir},g' \
>   -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \
> - ${D}${systemd_system_unitdir}/sshd.socket 
> ${D}${syste

Re: [OE-core] [PATCH v2] openssh: Add PACKAGECONFIG option to customize sshd mode

2023-12-04 Thread Alexandre Belloni via lists.openembedded.org
Hello,

On 05/12/2023 13:52:01+0800, Yu, Mingli wrote:
> From: Mingli Yu 
> 
> Add systemd-sshd-socket-mode PACKAGECONFIG option to choose sshd.socket
> and systemd-sshd-service-mode PACKAGECONFIG option to choose installing
> sshd.service.
> 
> The systemd-sshd-socket-mode PACKAGECONFIG option is enabled by default
> and user can customize the above two PACKAGECONFIG option to choose the
> sshd mode.
> 

This doesn't apply after 
https://lore.kernel.org/all/20231201140947.792594-1-xiangyu.c...@eng.windriver.com/

Can you synchronize and provide a working series?

> Signed-off-by: Mingli Yu 
> ---
>  .../openssh/openssh_9.5p1.bb  | 24 ++-
>  1 file changed, 18 insertions(+), 6 deletions(-)
> 
> diff --git a/meta/recipes-connectivity/openssh/openssh_9.5p1.bb 
> b/meta/recipes-connectivity/openssh/openssh_9.5p1.bb
> index bbb8fb091a..a10f5c5a61 100644
> --- a/meta/recipes-connectivity/openssh/openssh_9.5p1.bb
> +++ b/meta/recipes-connectivity/openssh/openssh_9.5p1.bb
> @@ -50,16 +50,20 @@ INITSCRIPT_NAME:${PN}-sshd = "sshd"
>  INITSCRIPT_PARAMS:${PN}-sshd = "defaults 9"
>  
>  SYSTEMD_PACKAGES = "${PN}-sshd"
> -SYSTEMD_SERVICE:${PN}-sshd = "sshd.socket sshd.service"
> +SYSTEMD_SERVICE:${PN}-sshd = 
> "${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-socket-mode','sshd.socket',
>  '', d)} 
> ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-service-mode','sshd.service',
>  '', d)}"
>  
>  inherit autotools-brokensep ptest pkgconfig
>  DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', 
> '', d)}"
>  
> -PACKAGECONFIG ??= ""
> +# systemd-sshd-socket-mode means sshd.socket and systemd-sshd-service-mode
> +# corresponding to sshd.service
> +PACKAGECONFIG ??= " systemd-sshd-socket-mode"
>  PACKAGECONFIG[kerberos] = "--with-kerberos5,--without-kerberos5,krb5"
>  PACKAGECONFIG[ldns] = "--with-ldns,--without-ldns,ldns"
>  PACKAGECONFIG[libedit] = "--with-libedit,--without-libedit,libedit"
>  PACKAGECONFIG[manpages] = "--with-mantype=man,--with-mantype=cat"
> +PACKAGECONFIG[systemd-sshd-socket-mode] = ""
> +PACKAGECONFIG[systemd-sshd-service-mode] = ""
>  
>  EXTRA_AUTORECONF += "--exclude=aclocal"
>  
> @@ -125,15 +129,23 @@ do_install:append () {
>   echo "HostKey /var/run/ssh/ssh_host_ed25519_key" >> 
> ${D}${sysconfdir}/ssh/sshd_config_readonly
>  
>   install -d ${D}${systemd_system_unitdir}
> - install -c -m 0644 ${WORKDIR}/sshd.socket ${D}${systemd_system_unitdir}
> - install -c -m 0644 ${WORKDIR}/sshd.service ${D}${systemd_system_unitdir}
> - install -c -m 0644 ${WORKDIR}/sshd@.service 
> ${D}${systemd_system_unitdir}
> + if 
> ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-socket-mode','true','false',d)};
>  then
> + install -c -m 0644 ${WORKDIR}/sshd.socket 
> ${D}${systemd_system_unitdir}
> + install -c -m 0644 ${WORKDIR}/sshd@.service 
> ${D}${systemd_system_unitdir}
> + sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \
> + -e 's,@SBINDIR@,${sbindir},g' \
> + -e 's,@BINDIR@,${bindir},g' \
> + -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \
> +${D}${systemd_system_unitdir}/sshd.socket
> + elif 
> ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-service-mode','true','false',d)};
>  then
> + install -c -m 0644 ${WORKDIR}/sshd.service 
> ${D}${systemd_system_unitdir}
> + fi
>   install -c -m 0644 ${WORKDIR}/sshdgenkeys.service 
> ${D}${systemd_system_unitdir}
>   sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \
>   -e 's,@SBINDIR@,${sbindir},g' \
>   -e 's,@BINDIR@,${bindir},g' \
>   -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \
> - ${D}${systemd_system_unitdir}/sshd.socket 
> ${D}${systemd_system_unitdir}/*.service
> + ${D}${systemd_system_unitdir}/*.service
>  
>   sed -i -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \
>   ${D}${sysconfdir}/init.d/sshd
> -- 
> 2.25.1
> 

> 
> 
> 


-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#191803): 
https://lists.openembedded.org/g/openembedded-core/message/191803
Mute This Topic: https://lists.openembedded.org/mt/102987153/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[OE-core] [PATCH v2] openssh: Add PACKAGECONFIG option to customize sshd mode

2023-12-04 Thread Yu, Mingli
From: Mingli Yu 

Add systemd-sshd-socket-mode PACKAGECONFIG option to choose sshd.socket
and systemd-sshd-service-mode PACKAGECONFIG option to choose installing
sshd.service.

The systemd-sshd-socket-mode PACKAGECONFIG option is enabled by default
and user can customize the above two PACKAGECONFIG option to choose the
sshd mode.

Signed-off-by: Mingli Yu 
---
 .../openssh/openssh_9.5p1.bb  | 24 ++-
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/meta/recipes-connectivity/openssh/openssh_9.5p1.bb 
b/meta/recipes-connectivity/openssh/openssh_9.5p1.bb
index bbb8fb091a..a10f5c5a61 100644
--- a/meta/recipes-connectivity/openssh/openssh_9.5p1.bb
+++ b/meta/recipes-connectivity/openssh/openssh_9.5p1.bb
@@ -50,16 +50,20 @@ INITSCRIPT_NAME:${PN}-sshd = "sshd"
 INITSCRIPT_PARAMS:${PN}-sshd = "defaults 9"
 
 SYSTEMD_PACKAGES = "${PN}-sshd"
-SYSTEMD_SERVICE:${PN}-sshd = "sshd.socket sshd.service"
+SYSTEMD_SERVICE:${PN}-sshd = 
"${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-socket-mode','sshd.socket', 
'', d)} 
${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-service-mode','sshd.service',
 '', d)}"
 
 inherit autotools-brokensep ptest pkgconfig
 DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', 
d)}"
 
-PACKAGECONFIG ??= ""
+# systemd-sshd-socket-mode means sshd.socket and systemd-sshd-service-mode
+# corresponding to sshd.service
+PACKAGECONFIG ??= " systemd-sshd-socket-mode"
 PACKAGECONFIG[kerberos] = "--with-kerberos5,--without-kerberos5,krb5"
 PACKAGECONFIG[ldns] = "--with-ldns,--without-ldns,ldns"
 PACKAGECONFIG[libedit] = "--with-libedit,--without-libedit,libedit"
 PACKAGECONFIG[manpages] = "--with-mantype=man,--with-mantype=cat"
+PACKAGECONFIG[systemd-sshd-socket-mode] = ""
+PACKAGECONFIG[systemd-sshd-service-mode] = ""
 
 EXTRA_AUTORECONF += "--exclude=aclocal"
 
@@ -125,15 +129,23 @@ do_install:append () {
echo "HostKey /var/run/ssh/ssh_host_ed25519_key" >> 
${D}${sysconfdir}/ssh/sshd_config_readonly
 
install -d ${D}${systemd_system_unitdir}
-   install -c -m 0644 ${WORKDIR}/sshd.socket ${D}${systemd_system_unitdir}
-   install -c -m 0644 ${WORKDIR}/sshd.service ${D}${systemd_system_unitdir}
-   install -c -m 0644 ${WORKDIR}/sshd@.service 
${D}${systemd_system_unitdir}
+   if 
${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-socket-mode','true','false',d)};
 then
+   install -c -m 0644 ${WORKDIR}/sshd.socket 
${D}${systemd_system_unitdir}
+   install -c -m 0644 ${WORKDIR}/sshd@.service 
${D}${systemd_system_unitdir}
+   sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \
+   -e 's,@SBINDIR@,${sbindir},g' \
+   -e 's,@BINDIR@,${bindir},g' \
+   -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \
+${D}${systemd_system_unitdir}/sshd.socket
+   elif 
${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-service-mode','true','false',d)};
 then
+   install -c -m 0644 ${WORKDIR}/sshd.service 
${D}${systemd_system_unitdir}
+   fi
install -c -m 0644 ${WORKDIR}/sshdgenkeys.service 
${D}${systemd_system_unitdir}
sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \
-e 's,@SBINDIR@,${sbindir},g' \
-e 's,@BINDIR@,${bindir},g' \
-e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \
-   ${D}${systemd_system_unitdir}/sshd.socket 
${D}${systemd_system_unitdir}/*.service
+   ${D}${systemd_system_unitdir}/*.service
 
sed -i -e 's,@LIBEXECDIR@,${libexecdir}/${BPN},g' \
${D}${sysconfdir}/init.d/sshd
-- 
2.25.1


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#191794): 
https://lists.openembedded.org/g/openembedded-core/message/191794
Mute This Topic: https://lists.openembedded.org/mt/102987153/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-