blob: b9c670b21fc1f054e5d6fa38a48bc83d6a970048 [file] [log] [blame]
lh758261d2023-07-13 05:52:04 -07001SUMMARY = "Daemon to translate SELinux MCS/MLS sensitivity labels"
2DESCRIPTION = "\
3mcstrans provides an translation daemon to translate SELinux categories \
4from internal representations to user defined representation."
5
6SECTION = "base"
7LICENSE = "GPLv2+"
8
9SRC_URI += "file://mcstrans-de-bashify.patch \
10 file://mcstrans-fix-the-init-script.patch \
11"
12
13inherit systemd update-rc.d
14
15DEPENDS += "libsepol libselinux libcap"
16
17# We do not need "${D}/" as a prefix anymore.
18EXTRA_OEMAKE += "SBINDIR=${base_sbindir} INITDIR=${sysconfdir}/init.d"
19
20do_install_append() {
21 install -d ${D}${sbindir}
22 install -m 755 utils/untranscon ${D}${sbindir}/
23 install -m 755 utils/transcon ${D}${sbindir}/
24
25 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
26 install -d ${D}${sysconfdir}/tmpfiles.d
27 echo "d ${localstatedir}/run/setrans - - - -" \
28 > ${D}${sysconfdir}/tmpfiles.d/setrans.conf
29 else
30 install -d ${D}${sysconfdir}/default/volatiles
31 echo "d root root 0755 /var/run/setrans none" \
32 >${D}${sysconfdir}/default/volatiles/80_mcstrans
33 fi
34 install -d ${D}${datadir}/mcstrans
35 cp -r share/* ${D}${datadir}/mcstrans/.
36}
37
38SYSTEMD_SERVICE_mcstrans = "mcstrans.service"
39INITSCRIPT_PACKAGES = "mcstrans"
40INITSCRIPT_NAME_mcstrans = "mcstrans"
41INITSCRIPT_PARAMS_mcstrans = "defaults"
42
43pkg_postinst_mcstrans () {
44 if [ -z "$D" ]; then
45 if command -v systemd-tmpfiles >/dev/null; then
46 systemd-tmpfiles --create ${sysconfdir}/tmpfiles.d/setrans.conf
47 elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then
48 ${sysconfdir}/init.d/populate-volatile.sh update
49 fi
50 fi
51}