diff mbox series

[V3,2/2] rootfs-postcommands.bbclass: fix echo + '\n' in 'no password' banner

Message ID 20251129154130.505619-2-Qi.Chen@windriver.com
State Accepted, archived
Commit 6dfb6c79588ae5542260047c2cd10e9c0cec43be
Headers show
Series [V3,1/2] rootfs-postcommands.bbclass: fix adding 'no password' banner | expand

Commit Message

ChenQi Nov. 29, 2025, 3:41 p.m. UTC
From: Chen Qi <Qi.Chen@windriver.com>

The '\n' means hostname instead of new line in /etc/issues.

bash and dash have different behavior on echo + '\n'.
So we avoid this '\n' and use an extra echo "" instead.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 meta/classes-recipe/rootfs-postcommands.bbclass | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Alexander Kanavin Nov. 29, 2025, 5:42 p.m. UTC | #1
This is ok, but you should probably order it to come first, so it can
be taken regardless of what happens to the other patch in the set.

Alex

On Sat, 29 Nov 2025 at 16:41, Chen Qi via lists.openembedded.org
<Qi.Chen=windriver.com@lists.openembedded.org> wrote:
>
> From: Chen Qi <Qi.Chen@windriver.com>
>
> The '\n' means hostname instead of new line in /etc/issues.
>
> bash and dash have different behavior on echo + '\n'.
> So we avoid this '\n' and use an extra echo "" instead.
>
> Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
> ---
>  meta/classes-recipe/rootfs-postcommands.bbclass | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/meta/classes-recipe/rootfs-postcommands.bbclass b/meta/classes-recipe/rootfs-postcommands.bbclass
> index bcc25798b9..a4e8517229 100644
> --- a/meta/classes-recipe/rootfs-postcommands.bbclass
> +++ b/meta/classes-recipe/rootfs-postcommands.bbclass
> @@ -262,7 +262,8 @@ add_empty_root_password_note () {
>         rootpw="`grep '^root:' ${IMAGE_ROOTFS}/etc/shadow | cut -d':' -f2`"
>         rootpw_lastchanged="`grep "^root:" ${IMAGE_ROOTFS}/etc/shadow | cut -d: -f3`"
>         if [ -z "$rootpw" -a "$rootpw_lastchanged" != "0" ]; then
> -               echo "Type 'root' to login with superuser privileges (no password will be asked).\n" >> ${IMAGE_ROOTFS}/etc/issue
> +               echo "Type 'root' to login with superuser privileges (no password will be asked)." >> ${IMAGE_ROOTFS}/etc/issue
> +               echo "" >> ${IMAGE_ROOTFS}/etc/issue
>         fi
>  }
>
> --
> 2.43.0
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#226942): https://lists.openembedded.org/g/openembedded-core/message/226942
> Mute This Topic: https://lists.openembedded.org/mt/116527246/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/meta/classes-recipe/rootfs-postcommands.bbclass b/meta/classes-recipe/rootfs-postcommands.bbclass
index bcc25798b9..a4e8517229 100644
--- a/meta/classes-recipe/rootfs-postcommands.bbclass
+++ b/meta/classes-recipe/rootfs-postcommands.bbclass
@@ -262,7 +262,8 @@  add_empty_root_password_note () {
 	rootpw="`grep '^root:' ${IMAGE_ROOTFS}/etc/shadow | cut -d':' -f2`"
 	rootpw_lastchanged="`grep "^root:" ${IMAGE_ROOTFS}/etc/shadow | cut -d: -f3`"
 	if [ -z "$rootpw" -a "$rootpw_lastchanged" != "0" ]; then
-		echo "Type 'root' to login with superuser privileges (no password will be asked).\n" >> ${IMAGE_ROOTFS}/etc/issue
+		echo "Type 'root' to login with superuser privileges (no password will be asked)." >> ${IMAGE_ROOTFS}/etc/issue
+		echo "" >> ${IMAGE_ROOTFS}/etc/issue
 	fi
 }