Andrew Geissler | f1e4406 | 2021-04-15 15:52:46 -0500 | [diff] [blame] | 1 | SUMMARY = "Platform AbstRaction for SECurity Daemon" |
| 2 | HOMEPAGE = "https://github.com/parallaxsecond/parsec" |
| 3 | LICENSE = "Apache-2.0" |
| 4 | |
| 5 | inherit cargo |
| 6 | |
| 7 | SRC_URI += "crate://crates.io/parsec-service/${PV} \ |
| 8 | file://parsec_init \ |
| 9 | file://systemd.patch \ |
| 10 | file://parsec-tmpfiles.conf \ |
| 11 | " |
| 12 | |
| 13 | DEPENDS = "tpm2-tss" |
| 14 | TOOLCHAIN = "clang" |
| 15 | |
| 16 | CARGO_BUILD_FLAGS += " --features all-providers,cryptoki/generate-bindings,tss-esapi/generate-bindings" |
| 17 | |
| 18 | inherit systemd |
| 19 | SYSTEMD_SERVICE_${PN} = "parsec.service" |
| 20 | |
| 21 | inherit update-rc.d |
| 22 | INITSCRIPT_NAME = "parsec" |
| 23 | |
| 24 | # A local file can be defined in build/local.conf |
| 25 | # The file should also be included into SRC_URI then |
| 26 | PARSEC_CONFIG ?= "${S}/config.toml" |
| 27 | |
| 28 | do_install_append () { |
| 29 | # Binaries |
| 30 | install -d -m 700 -o parsec -g parsec "${D}${libexecdir}/parsec" |
| 31 | install -m 700 -o parsec -g parsec "${WORKDIR}/build/target/${CARGO_TARGET_SUBDIR}/parsec" ${D}${libexecdir}/parsec/parsec |
| 32 | |
| 33 | # Config file |
| 34 | install -d -m 700 -o parsec -g parsec "${D}${sysconfdir}/parsec" |
| 35 | install -m 400 -o parsec -g parsec "${PARSEC_CONFIG}" ${D}${sysconfdir}/parsec/config.toml |
| 36 | |
| 37 | # Data dir |
| 38 | install -d -m 700 -o parsec -g parsec "${D}${localstatedir}/lib/parsec" |
| 39 | |
| 40 | if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then |
| 41 | install -d ${D}${systemd_unitdir}/system |
| 42 | install -m 644 ${S}/systemd-daemon/parsec.service ${D}${systemd_unitdir}/system |
| 43 | |
| 44 | install -d ${D}${libdir}/tmpfiles.d |
| 45 | install -m 644 ${WORKDIR}/parsec-tmpfiles.conf ${D}${libdir}/tmpfiles.d |
| 46 | fi |
| 47 | |
| 48 | if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then |
| 49 | install -d ${D}${sysconfdir}/init.d |
| 50 | install -m 755 ${WORKDIR}/parsec_init ${D}${sysconfdir}/init.d/parsec |
| 51 | fi |
| 52 | } |
| 53 | |
| 54 | inherit useradd |
| 55 | USERADD_PACKAGES = "${PN}" |
| 56 | USERADD_PARAM_${PN} = "-r -g parsec -s /bin/false -d ${localstatedir}/lib/parsec parsec" |
| 57 | GROUPADD_PARAM_${PN} = "-r parsec" |
| 58 | |
| 59 | FILES_${PN} += " \ |
| 60 | ${sysconfdir}/parsec/config.toml \ |
| 61 | ${libexecdir}/parsec/parsec \ |
| 62 | ${systemd_unitdir}/system/parsec.service \ |
| 63 | ${libdir}/tmpfiles.d/parsec-tmpfiles.conf \ |
| 64 | ${sysconfdir}/init.d/parsec \ |
| 65 | " |
| 66 | |
| 67 | require parsec-service_${PV}.inc |