lh | 758261d | 2023-07-13 05:52:04 -0700 | [diff] [blame^] | 1 | S ?= "${WORKDIR}" |
| 2 | SECTION ?= "base" |
| 3 | |
| 4 | # Default is for script name to be the same as the recipe name. |
| 5 | # Script must have .sh suffix. |
| 6 | SELINUX_SCRIPT_SRC ?= "${BPN}" |
| 7 | SELINUX_SCRIPT_DST ?= "${SELINUX_SCRIPT_SRC}" |
| 8 | |
| 9 | INITSCRIPT_NAME ?= "${SELINUX_SCRIPT_DST}" |
| 10 | INITSCRIPT_PARAMS ?= "start 00 S ." |
| 11 | |
| 12 | CONFFILES_${PN} += "${sysconfdir}/init.d/${SELINUX_SCRIPT_DST}" |
| 13 | |
| 14 | PACKAGE_ARCH ?= "${MACHINE_ARCH}" |
| 15 | |
| 16 | inherit update-rc.d systemd |
| 17 | |
| 18 | SYSTEMD_SERVICE_${PN} = "${SELINUX_SCRIPT_SRC}.service" |
| 19 | |
| 20 | FILES_${PN} += "/.autorelabel" |
| 21 | |
| 22 | do_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 | |
| 39 | sysroot_stage_all_append () { |
| 40 | sysroot_stage_dir ${D}${sysconfdir} ${SYSROOT_DESTDIR}${sysconfdir} |
| 41 | } |