blob: f6a3d854fbe56f9dcb6459e1f2d460ca0322ce3f [file] [log] [blame]
lh758261d2023-07-13 05:52:04 -07001S ?= "${WORKDIR}"
2SECTION ?= "base"
3
4# Default is for script name to be the same as the recipe name.
5# Script must have .sh suffix.
6SELINUX_SCRIPT_SRC ?= "${BPN}"
7SELINUX_SCRIPT_DST ?= "${SELINUX_SCRIPT_SRC}"
8
9INITSCRIPT_NAME ?= "${SELINUX_SCRIPT_DST}"
10INITSCRIPT_PARAMS ?= "start 00 S ."
11
12CONFFILES:${PN} += "${sysconfdir}/init.d/${SELINUX_SCRIPT_DST}"
13
14PACKAGE_ARCH ?= "${MACHINE_ARCH}"
15
16inherit update-rc.d systemd
17
18SYSTEMD_SERVICE:${PN} = "${SELINUX_SCRIPT_SRC}.service"
19
20FILES:${PN} += "/.autorelabel"
21
22do_install () {
23 install -d ${D}${sysconfdir}/init.d/
24 install -m 0755 ${WORKDIR}/${SELINUX_SCRIPT_SRC}.sh ${D}${sysconfdir}/init.d/${SELINUX_SCRIPT_DST}
25 # Insert the relabelling code which is only needed with sysvinit
26 sed -i -e '/HERE/r ${WORKDIR}/${SELINUX_SCRIPT_SRC}.sh.sysvinit' \
27 -e '/.*HERE$/d' -e '/.*Contents.*sysvinit/d' \
28 ${D}${sysconfdir}/init.d/${SELINUX_SCRIPT_DST}
29
30 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
31 install -d ${D}${systemd_unitdir}/system
32 install -m 0644 ${WORKDIR}/${SELINUX_SCRIPT_SRC}.service ${D}${systemd_unitdir}/system
33 install -d ${D}${bindir}
34 install -m 0755 ${WORKDIR}/${SELINUX_SCRIPT_SRC}.sh ${D}${bindir}
35 sed -i -e '/.*HERE$/d' ${D}${bindir}/${SELINUX_SCRIPT_SRC}.sh
36 fi
37}
38
39sysroot_stage_all:append () {
40 sysroot_stage_dir ${D}${sysconfdir} ${SYSROOT_DESTDIR}${sysconfdir}
41}