From: Robert Yang Date: Fri, 5 Mar 2021 03:28:57 +0000 (+0800) Subject: rootfs-postcommands.bbclass: Print a warning when login with root is disabled X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=870b35befc0b8fa9cd1c3a03fcfd2395440c2f41;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git rootfs-postcommands.bbclass: Print a warning when login with root is disabled 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 --- diff --git a/meta/classes/rootfs-postcommands.bbclass b/meta/classes/rootfs-postcommands.bbclass index 1f27a3d07a8..e4fe416ac99 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