diff mbox series

[meta-selinux,2/3] selinux-autorelabel: enable labeling during build

Message ID 20230922022236.3578345-2-yi.zhao@windriver.com
State New
Headers show
Series [meta-selinux,1/3] selinux-image.bbclass: refactor bbclass | expand

Commit Message

Yi Zhao Sept. 22, 2023, 2:22 a.m. UTC
Previously, system using systemd would label selinux contexts on first
boot. While system using sysvinit would label during build. Add a
variable FIRST_BOOT_RELABEL as a switch to control labeling to make the
behavior of sysvinit and systemd consistent.

Set FIRST_BOOT_RELABEL to 1 in local.conf to enable labeling on first
boot.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
---
 recipes-security/selinux-scripts/selinux-autorelabel_0.1.bb | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/recipes-security/selinux-scripts/selinux-autorelabel_0.1.bb b/recipes-security/selinux-scripts/selinux-autorelabel_0.1.bb
index a919445..9fd066c 100644
--- a/recipes-security/selinux-scripts/selinux-autorelabel_0.1.bb
+++ b/recipes-security/selinux-scripts/selinux-autorelabel_0.1.bb
@@ -20,7 +20,7 @@  INITSCRIPT_PARAMS = "start 01 S ."
 require selinux-initsh.inc
 
 do_install:append() {
-	if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
-		echo "# first boot relabelling" > ${D}/.autorelabel
-	fi
+    if ${@bb.utils.contains('FIRST_BOOT_RELABEL', '1', 'true', 'false', d)}; then
+        echo "# first boot relabelling" > ${D}/.autorelabel
+    fi
 }