blob: 7f157d3cc5e2d11f0a7729a2f289821b5dc4d734 [file] [log] [blame]
lh758261d2023-07-13 05:52:04 -07001selinux_set_labels () {
2 POL_TYPE=$(sed -n -e "s&^SELINUXTYPE[[:space:]]*=[[:space:]]*\([0-9A-Za-z_]\+\)&\1&p" ${IMAGE_ROOTFS}/${sysconfdir}/selinux/config)
3 if ! setfiles -m -r ${IMAGE_ROOTFS} ${IMAGE_ROOTFS}/${sysconfdir}/selinux/${POL_TYPE}/contexts/files/file_contexts ${IMAGE_ROOTFS}
4 then
5 echo WARNING: Unable to set filesystem context, setfiles / restorecon must be run on the live image.
6 touch ${IMAGE_ROOTFS}/.autorelabel
7 exit 0
8 fi
9}
10
11DEPENDS += "policycoreutils-native"
12
13IMAGE_PREPROCESS_COMMAND_append = " selinux_set_labels ;"
14
15inherit core-image