Skip to content

Commit f02174d

Browse files
committed
build_sysexts: Relabel sysexts too
Signed-off-by: Krzesimir Nowak <[email protected]>
1 parent 016911d commit f02174d

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

build_sysext

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,9 @@ done
241241
# Make squashfs generation more reproducible.
242242
export SOURCE_DATE_EPOCH=$(stat -c '%Y' "${BUILD_DIR}/fs-root/usr/lib/os-release")
243243

244-
# Unmount in order to get rid of the overlay
244+
# Unmount in order to get rid of the overlay, but keep fs-root for
245+
# now, so we can use selinux file contexts.
245246
umount "${BUILD_DIR}/${FLAGS_install_root_basename}"
246-
umount "${BUILD_DIR}/fs-root"
247247

248248
if [[ "$FLAGS_generate_pkginfo" = "${FLAGS_TRUE}" ]] ; then
249249
info " Creating pkginfo squashfs '${BUILD_DIR}/${SYSEXTNAME}_pkginfo.raw'"
@@ -328,11 +328,16 @@ if [[ -n "${invalid_files}" ]]; then
328328
die "Invalid file ownership: ${invalid_files}"
329329
fi
330330

331+
info "Relabeling sysext contents"
332+
setfiles -D -E -F -r "${BUILD_DIR}/${FLAGS_install_root_basename}" -v -T 0 "${BUILD_DIR}/fs-root/usr/share/flatcar/etc/selinux/mcs/contexts/files/file_contexts" "${BUILD_DIR}/${FLAGS_install_root_basename}"
333+
umount "${BUILD_DIR}/fs-root"
334+
335+
info "Creating squashfs image"
331336
mksquashfs "${BUILD_DIR}/${FLAGS_install_root_basename}" "${BUILD_DIR}/${SYSEXTNAME}.raw" \
332337
-noappend -xattrs-exclude '^btrfs.' -comp "${FLAGS_compression}" ${FLAGS_mksquashfs_opts}
333338
rm -rf "${BUILD_DIR}"/{fs-root,"${FLAGS_install_root_basename}",workdir}
334339

335-
# Generate reports
340+
info "Generating reports"
336341
mkdir "${BUILD_DIR}/img-rootfs"
337342
mount -rt squashfs -o loop,nodev "${BUILD_DIR}/${SYSEXTNAME}.raw" "${BUILD_DIR}/img-rootfs"
338343
write_contents "${BUILD_DIR}/img-rootfs" "${BUILD_DIR}/${SYSEXTNAME}_contents.txt"

0 commit comments

Comments
 (0)