meta-selinux/recipes-security/selinux-scripts/selinux-initsh.inc
Scott Murray 05178ce178 Adapt to UNPACKDIR changes
Remove or update S definitions as required to work with oe-core
S/UNPACKDIR changes.  A default definition of S has been added to
selinux_common.inc to avoid duplication in the set of recipes that
use it to build packages from different subdirectories of the selinux
repo.  The three packagegroups test build successfully with these
changes.

Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2025-06-30 13:38:18 +08:00

43 lines
1.4 KiB
PHP

S = "${UNPACKDIR}"
SECTION ?= "base"
# Default is for script name to be the same as the recipe name.
# Script must have .sh suffix.
SELINUX_SCRIPT_SRC ?= "${BPN}"
SELINUX_SCRIPT_DST ?= "${SELINUX_SCRIPT_SRC}"
INITSCRIPT_NAME ?= "${SELINUX_SCRIPT_DST}"
INITSCRIPT_PARAMS ?= "start 00 S ."
CONFFILES:${PN} += "${sysconfdir}/init.d/${SELINUX_SCRIPT_DST}"
PACKAGE_ARCH ?= "${MACHINE_ARCH}"
inherit update-rc.d systemd
SYSTEMD_SERVICE:${PN} = "${SELINUX_SCRIPT_SRC}.service"
FILES:${PN} += "/.autorelabel"
do_install () {
install -d ${D}${sysconfdir}/init.d/
install -m 0755 ${S}/${SELINUX_SCRIPT_SRC}.sh ${D}${sysconfdir}/init.d/${SELINUX_SCRIPT_DST}
# Insert the relabelling code which is only needed with sysvinit
sed -i -e '/HERE/r ${S}/${SELINUX_SCRIPT_SRC}.sh.sysvinit' \
-e '/.*HERE$/d' -e '/.*Contents.*sysvinit/d' \
${D}${sysconfdir}/init.d/${SELINUX_SCRIPT_DST}
if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
install -d ${D}${systemd_unitdir}/system
install -m 0644 ${S}/${SELINUX_SCRIPT_SRC}.service ${D}${systemd_unitdir}/system
install -d ${D}${bindir}
install -m 0755 ${S}/${SELINUX_SCRIPT_SRC}.sh ${D}${bindir}
sed -i -e '/.*HERE$/d' ${D}${bindir}/${SELINUX_SCRIPT_SRC}.sh
fi
}
sysroot_stage_all:append () {
sysroot_stage_dir ${D}${sysconfdir} ${SYSROOT_DESTDIR}${sysconfdir}
}