TEST-06-SELINUX: Relabel in the initrd rather than at image build time

This gets rid of the requirement to run the image build as root.
This commit is contained in:
Daan De Meyer
2026-04-14 20:35:24 +02:00
committed by Daan De Meyer
parent 014a4d93e0
commit 72cfcfa0ec
7 changed files with 25 additions and 23 deletions
@@ -1,19 +1,20 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
id = find_program('id', required : true)
uid = run_command(id, '-u', check : true).stdout().strip().to_int()
integration_tests += [
integration_test_template + {
'name' : fs.name(meson.current_source_dir()),
'cmdline' : integration_test_template['cmdline'] + ['selinux=1', 'enforcing=0', 'lsm=selinux'],
'cmdline' : integration_test_template['cmdline'] + [
'selinux=1',
'enforcing=0',
'lsm=selinux',
'rd.systemd.wants=initrd-selinux-relabel.service',
],
# FIXME; Figure out why reboot sometimes hangs with 'linux' firmware.
# Use 'auto' to automatically fallback on non-uefi architectures.
'firmware' : 'auto',
'vm' : true,
# Make sure we don't mount anything with virtiofs as otherwise fixfiles will try to relabel
# Make sure we don't mount anything with virtiofs as otherwise setfiles will try to relabel
# it.
'mkosi-args' : integration_test_template['mkosi-args'] + ['--runtime-build-sources=no'],
'enabled' : uid == 0,
},
]