diff options
author | Joakim Tjernlund <joakim.tjernlund@infinera.com> | 2023-11-14 14:28:42 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-11-20 15:30:52 +0000 |
commit | a2ea2cb8d92b56bfd4a0d8803592eb507c6bd4b4 (patch) | |
tree | 4e71e2310e3fac2c4e0443f00c9836cc90ee43ee /meta/classes-recipe | |
parent | 35fa9488cb768bb6d94f69268678e3d5b61dd237 (diff) | |
download | poky-a2ea2cb8d92b56bfd4a0d8803592eb507c6bd4b4.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: 6ec004b2e7b4342465af8e5e6cc66041834821a0)
Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes-recipe')
-rw-r--r-- | meta/classes-recipe/rootfs-postcommands.bbclass | 4 |
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 | # |
242 | zap_empty_root_password () { | 242 | zap_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 | ||