summaryrefslogtreecommitdiffstats
path: root/meta/classes-recipe/rootfs-postcommands.bbclass
diff options
context:
space:
mode:
authorJoakim Tjernlund <joakim.tjernlund@infinera.com>2023-11-14 14:28:42 +0100
committerSteve Sakoman <steve@sakoman.com>2024-01-04 04:09:43 -1000
commitd2d9fd706364e9901a5575ffa0e7579383cff01e (patch)
tree40170529380fe0b0742e2f3eb7ec5438b593ad66 /meta/classes-recipe/rootfs-postcommands.bbclass
parent40a11d6e2a5cea09f116ab7520429140067e8229 (diff)
downloadpoky-d2d9fd706364e9901a5575ffa0e7579383cff01e.tar.gz
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: 7b4343a30a02d8f8664ac4c4bc09e5acfb4fa60e) Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> (cherry picked from commit 6ec004b2e7b4342465af8e5e6cc66041834821a0) Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'meta/classes-recipe/rootfs-postcommands.bbclass')
-rw-r--r--meta/classes-recipe/rootfs-postcommands.bbclass4
1 files changed, 2 insertions, 2 deletions
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 () {
241# 241#
242zap_empty_root_password () { 242zap_empty_root_password () {
243 if [ -e ${IMAGE_ROOTFS}/etc/shadow ]; then 243 if [ -e ${IMAGE_ROOTFS}/etc/shadow ]; then
244 sed -i 's%^root::%root:*:%' ${IMAGE_ROOTFS}/etc/shadow 244 sed --follow-symlinks -i 's%^root::%root:*:%' ${IMAGE_ROOTFS}/etc/shadow
245 fi 245 fi
246 if [ -e ${IMAGE_ROOTFS}/etc/passwd ]; then 246 if [ -e ${IMAGE_ROOTFS}/etc/passwd ]; then
247 sed -i 's%^root::%root:*:%' ${IMAGE_ROOTFS}/etc/passwd 247 sed --follow-symlinks -i 's%^root::%root:*:%' ${IMAGE_ROOTFS}/etc/passwd
248 fi 248 fi
249} 249}
250 250