From a2ea2cb8d92b56bfd4a0d8803592eb507c6bd4b4 Mon Sep 17 00:00:00 2001 From: Joakim Tjernlund Date: Tue, 14 Nov 2023 14:28:42 +0100 Subject: sed -i destroys symlinks If /etc/passwd is a symlink, sed -i on same file will replace the symlink with a new file. Prevent that by adding --follow-symlinks option to sed (From OE-Core rev: 6ec004b2e7b4342465af8e5e6cc66041834821a0) Signed-off-by: Joakim Tjernlund Signed-off-by: Alexandre Belloni Signed-off-by: Richard Purdie --- meta/classes-recipe/rootfs-postcommands.bbclass | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'meta/classes-recipe') diff --git a/meta/classes-recipe/rootfs-postcommands.bbclass b/meta/classes-recipe/rootfs-postcommands.bbclass index 06388b72fb..29ee74932a 100644 --- a/meta/classes-recipe/rootfs-postcommands.bbclass +++ b/meta/classes-recipe/rootfs-postcommands.bbclass @@ -241,10 +241,10 @@ read_only_rootfs_hook () { # zap_empty_root_password () { if [ -e ${IMAGE_ROOTFS}/etc/shadow ]; then - sed -i 's%^root::%root:*:%' ${IMAGE_ROOTFS}/etc/shadow + sed --follow-symlinks -i 's%^root::%root:*:%' ${IMAGE_ROOTFS}/etc/shadow fi if [ -e ${IMAGE_ROOTFS}/etc/passwd ]; then - sed -i 's%^root::%root:*:%' ${IMAGE_ROOTFS}/etc/passwd + sed --follow-symlinks -i 's%^root::%root:*:%' ${IMAGE_ROOTFS}/etc/passwd fi } -- cgit v1.2.3-54-g00ecf