浏览代码

image.mk: evaluate /etc/selinux/config to choose SELinux policy

Instead of hardcoding 'targeted' policy, evaluate /etc/selinux/config
in rootfs to choose according to which policy files in the rootfs got
to be labeled.

Signed-off-by: Daniel Golle <[email protected]>
Daniel Golle 5 年之前
父节点
当前提交
26aa7952d5
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      include/image.mk

+ 3 - 2
include/image.mk

@@ -243,10 +243,11 @@ endef
 
 
 ifeq ($(CONFIG_TARGET_ROOTFS_SECURITY_LABELS),y)
 ifeq ($(CONFIG_TARGET_ROOTFS_SECURITY_LABELS),y)
 define Image/mkfs/squashfs
 define Image/mkfs/squashfs
+	echo ". $(call mkfs_target_dir,$(1))/etc/selinux/config" > [email protected]
 	echo "$(STAGING_DIR_HOST)/bin/setfiles -r" \
 	echo "$(STAGING_DIR_HOST)/bin/setfiles -r" \
 	     "$(call mkfs_target_dir,$(1))" \
 	     "$(call mkfs_target_dir,$(1))" \
-	     "$(call mkfs_target_dir,$(1))/etc/selinux/targeted/contexts/files/file_contexts " \
-	     "$(call mkfs_target_dir,$(1))" > [email protected]
+	     "$(call mkfs_target_dir,$(1))/etc/selinux/\$${SELINUXTYPE}/contexts/files/file_contexts " \
+	     "$(call mkfs_target_dir,$(1))" >> [email protected]
 	echo "$(Image/mkfs/squashfs-common)" >> [email protected]
 	echo "$(Image/mkfs/squashfs-common)" >> [email protected]
 	chmod +x [email protected]
 	chmod +x [email protected]
 	$(FAKEROOT) "[email protected]"
 	$(FAKEROOT) "[email protected]"