image-oci-unmoci: preserve file modes

Based on the following patch:

   Subject: [meta-virtualization][PATCH] image-oci-umoci: preserve file modes in rootfs
   From: "Florian Wickert via lists.yoctoproject.org" <FlorianWickert=gmail.com@lists.yoctoproject.org>

   cp does not preserve file modes by default.
   This will break sudo (among others) which needs the suid flag to do its
   work.

   This patch adds the --preserve=mode flag to the cp call to fix this.

   Signed-off-by: Florian Wickert <FlorianWickert@gmail.com>

Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
This commit is contained in:
Bruce Ashfield 2025-01-17 19:09:57 +00:00
parent 3763a3a9a6
commit 57fe8d0364

View File

@ -50,7 +50,7 @@ IMAGE_CMD:oci() {
bbdebug 1 "OCI: populating rootfs"
bbdebug 1 "OCI: cp -r ${IMAGE_ROOTFS}/* $image_bundle_name/rootfs/"
cp -r ${IMAGE_ROOTFS}/* $image_bundle_name/rootfs
cp -r -a --no-preserve=ownership ${IMAGE_ROOTFS}/* $image_bundle_name/rootfs
bbdebug 1 "OCI: umoci repack --image $image_name:${OCI_IMAGE_TAG} $image_bundle_name"
umoci repack --image $image_name:${OCI_IMAGE_TAG} $image_bundle_name