summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/core-image.bbclass2
-rw-r--r--meta/classes/image.bbclass14
2 files changed, 9 insertions, 7 deletions
diff --git a/meta/classes/core-image.bbclass b/meta/classes/core-image.bbclass
index e7c34e2791..fc4bd2f6f1 100644
--- a/meta/classes/core-image.bbclass
+++ b/meta/classes/core-image.bbclass
@@ -74,7 +74,7 @@ inherit image
74ROOTFS_POSTPROCESS_COMMAND += "rootfs_update_timestamp ; " 74ROOTFS_POSTPROCESS_COMMAND += "rootfs_update_timestamp ; "
75 75
76# Zap the root password if debug-tweaks feature is not enabled 76# Zap the root password if debug-tweaks feature is not enabled
77ROOTFS_POSTPROCESS_COMMAND += '${@base_contains("IMAGE_FEATURES", "debug-tweaks", "", "zap_root_password ; ",d)}' 77ROOTFS_POSTPROCESS_COMMAND += '${@base_contains("IMAGE_FEATURES", "debug-tweaks", "", "zap_empty_root_password ; ",d)}'
78 78
79# Tweak the mount options for rootfs in /etc/fstab if read-only-rootfs is enabled 79# Tweak the mount options for rootfs in /etc/fstab if read-only-rootfs is enabled
80ROOTFS_POSTPROCESS_COMMAND += '${@base_contains("IMAGE_FEATURES", "read-only-rootfs", "read_only_rootfs_hook; ", "",d)}' 80ROOTFS_POSTPROCESS_COMMAND += '${@base_contains("IMAGE_FEATURES", "read-only-rootfs", "read_only_rootfs_hook; ", "",d)}'
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 012aef3bcc..c59572104d 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -562,11 +562,13 @@ rootfs_uninstall_unneeded () {
562 fi 562 fi
563} 563}
564 564
565# set '*' as the root password so the images 565# This function is intended to disallow empty root password if 'debug-tweaks' is not in IMAGE_FEATURES.
566# can decide if they want it or not 566zap_empty_root_password () {
567zap_root_password () { 567 if [ -e ${IMAGE_ROOTFS}/etc/shadow ]; then
568 sed 's%^root:[^:]*:%root:*:%' < ${IMAGE_ROOTFS}/etc/passwd >${IMAGE_ROOTFS}/etc/passwd.new 568 sed -i 's%^root::%root:*:%' ${IMAGE_ROOTFS}/etc/shadow
569 mv ${IMAGE_ROOTFS}/etc/passwd.new ${IMAGE_ROOTFS}/etc/passwd 569 elif [ -e ${IMAGE_ROOTFS}/etc/passwd ]; then
570 sed -i 's%^root::%root:*:%' ${IMAGE_ROOTFS}/etc/passwd
571 fi
570} 572}
571 573
572# allow dropbear/openssh to accept root logins and logins from accounts with an empty password string 574# allow dropbear/openssh to accept root logins and logins from accounts with an empty password string
@@ -648,7 +650,7 @@ rootfs_sysroot_relativelinks () {
648 sysroot-relativelinks.py ${SDK_OUTPUT}/${SDKTARGETSYSROOT} 650 sysroot-relativelinks.py ${SDK_OUTPUT}/${SDKTARGETSYSROOT}
649} 651}
650 652
651EXPORT_FUNCTIONS zap_root_password remove_init_link do_rootfs make_zimage_symlink_relative set_image_autologin rootfs_update_timestamp rootfs_no_x_startup 653EXPORT_FUNCTIONS zap_empty_root_password remove_init_link do_rootfs make_zimage_symlink_relative set_image_autologin rootfs_update_timestamp rootfs_no_x_startup
652 654
653do_fetch[noexec] = "1" 655do_fetch[noexec] = "1"
654do_unpack[noexec] = "1" 656do_unpack[noexec] = "1"