build_library/build_image_util.sh: move image modification before trim

The trim should be the last action before the image is finalized,
otherwise it may not result in the minimal size.
This commit is contained in:
Kai Lueke 2022-03-24 12:49:06 +01:00
parent d75c199726
commit 7de89044c7

View File

@ -686,6 +686,11 @@ EOF
"${BUILD_DIR}/${image_kconfig}"
fi
# Build the selinux policy
if pkg_use_enabled coreos-base/coreos selinux; then
sudo chroot "${root_fs_dir}" bash -c "cd /usr/share/selinux/mcs && semodule -s mcs -i *.pp"
fi
write_contents "${root_fs_dir}" "${BUILD_DIR}/${image_contents}"
# Zero all fs free space to make it more compressible so auto-update
@ -695,11 +700,6 @@ EOF
sudo fstrim "${root_fs_dir}/usr" || true
fi
# Build the selinux policy
if pkg_use_enabled coreos-base/coreos selinux; then
sudo chroot "${root_fs_dir}" bash -c "cd /usr/share/selinux/mcs && semodule -s mcs -i *.pp"
fi
# Make the filesystem un-mountable as read-write and setup verity.
if [[ ${disable_read_write} -eq ${FLAGS_TRUE} ]]; then
# Unmount /usr partition