All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Robert Yang" <liezhi.yang@windriver.com>
To: <openembedded-core@lists.openembedded.org>
Subject: [PATCH 1/1] rootfs-postcommands.bbclass: Print a warning when login with root is disabled
Date: Fri, 5 Mar 2021 16:49:20 +0800	[thread overview]
Message-ID: <870b35befc0b8fa9cd1c3a03fcfd2395440c2f41.1614916931.git.liezhi.yang@windriver.com> (raw)
In-Reply-To: <cover.1614916931.git.liezhi.yang@windriver.com>

Fixed:
EXTRA_IMAGE_FEATURES_remove = "debug-tweaks"
$ bitbake core-image-minimal

Then we can't login to the system with root without any messages. Add a warning
makes it easy to debug.

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 meta/classes/rootfs-postcommands.bbclass | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/meta/classes/rootfs-postcommands.bbclass b/meta/classes/rootfs-postcommands.bbclass
index 1f27a3d07a..e4fe416ac9 100644
--- a/meta/classes/rootfs-postcommands.bbclass
+++ b/meta/classes/rootfs-postcommands.bbclass
@@ -147,7 +147,11 @@ read_only_rootfs_hook () {
 zap_empty_root_password () {
 	if [ -e ${IMAGE_ROOTFS}/etc/shadow ]; then
 		sed -i 's%^root::%root:*:%' ${IMAGE_ROOTFS}/etc/shadow
-        fi
+		grep -q '^root:*:' ${IMAGE_ROOTFS}/etc/shadow
+		if [ $? -eq 0 ]; then
+			bbwarn "Login with root user is disabled since zap_empty_root_password is enabled"
+		fi
+	fi
 	if [ -e ${IMAGE_ROOTFS}/etc/passwd ]; then
 		sed -i 's%^root::%root:*:%' ${IMAGE_ROOTFS}/etc/passwd
 	fi
-- 
2.17.1


  reply	other threads:[~2021-03-05  8:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-05  8:49 [PATCH 0/1] rootfs-postcommands.bbclass: Print a warning when login with root is disabled Robert Yang
2021-03-05  8:49 ` Robert Yang [this message]
2021-03-05 10:18   ` [OE-core] [PATCH 1/1] " Peter Kjellerstedt
2021-03-09  8:32     ` Robert Yang
2021-03-12 14:13       ` Peter Kjellerstedt
2021-03-15  2:31         ` Robert Yang
2021-03-15 11:14           ` Peter Kjellerstedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=870b35befc0b8fa9cd1c3a03fcfd2395440c2f41.1614916931.git.liezhi.yang@windriver.com \
    --to=liezhi.yang@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.