]> code.ossystems Code Review - openembedded-core.git/commitdiff
wic/isoimage-isohybrid.py: change cpio generated uid&gid to root
authorIoan-Adrian Ratiu <adrian.ratiu@ni.com>
Fri, 1 Apr 2016 14:31:20 +0000 (17:31 +0300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 3 Apr 2016 14:51:08 +0000 (15:51 +0100)
By default cpio preserves the uid&guid's of the original user which
leads to host contamination and boot failures because commands like
mount from initramfs expect to be run by root and the original host
user might not even exist on the target.

Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu@ni.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/lib/wic/plugins/source/isoimage-isohybrid.py

index de99ad849559dd4ef74884b8e3d23c96385a4d42..bc9928314ce50c12e0b8577d15071cfd9d991b76 100644 (file)
@@ -174,8 +174,8 @@ class IsoImagePlugin(SourcePlugin):
             else:
                 msger.error("Couldn't find or build initrd, exiting.\n")
 
-            exec_cmd("find %s | cpio -o -H newc >%s/initrd.cpio " \
-                    % (initrd_dir, cr_workdir), as_shell=True)
+            exec_cmd("cd %s && find . | cpio -o -H newc -R +0:+0 >./initrd.cpio " \
+                    % initrd_dir, as_shell=True)
             exec_cmd("gzip -f -9 -c %s/initrd.cpio > %s" \
                     % (cr_workdir, initrd), as_shell=True)
             shutil.rmtree(initrd_dir)