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 | |
Andrew Geissler | 59125e0 | 2021-07-23 12:56:22 -0400 | [diff] [blame] | 13 | DEPENDS = "tpm2-tss clang-native" |
Andrew Geissler | f1e4406 | 2021-04-15 15:52:46 -0500 | [diff] [blame] | 14 | |
| 15 | CARGO_BUILD_FLAGS += " --features all-providers,cryptoki/generate-bindings,tss-esapi/generate-bindings" |
| 16 | |
| 17 | inherit systemd |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 18 | SYSTEMD_SERVICE:${PN} = "parsec.service" |
Andrew Geissler | f1e4406 | 2021-04-15 15:52:46 -0500 | [diff] [blame] | 19 | |
| 20 | inherit update-rc.d |
| 21 | INITSCRIPT_NAME = "parsec" |
| 22 | |
| 23 | # A local file can be defined in build/local.conf |
| 24 | # The file should also be included into SRC_URI then |
| 25 | PARSEC_CONFIG ?= "${S}/config.toml" |
| 26 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 27 | do_install:append () { |
Andrew Geissler | f1e4406 | 2021-04-15 15:52:46 -0500 | [diff] [blame] | 28 | # Binaries |
| 29 | install -d -m 700 -o parsec -g parsec "${D}${libexecdir}/parsec" |
| 30 | install -m 700 -o parsec -g parsec "${WORKDIR}/build/target/${CARGO_TARGET_SUBDIR}/parsec" ${D}${libexecdir}/parsec/parsec |
| 31 | |
| 32 | # Config file |
| 33 | install -d -m 700 -o parsec -g parsec "${D}${sysconfdir}/parsec" |
| 34 | install -m 400 -o parsec -g parsec "${PARSEC_CONFIG}" ${D}${sysconfdir}/parsec/config.toml |
| 35 | |
| 36 | # Data dir |
| 37 | install -d -m 700 -o parsec -g parsec "${D}${localstatedir}/lib/parsec" |
| 38 | |
| 39 | if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then |
| 40 | install -d ${D}${systemd_unitdir}/system |
| 41 | install -m 644 ${S}/systemd-daemon/parsec.service ${D}${systemd_unitdir}/system |
| 42 | |
| 43 | install -d ${D}${libdir}/tmpfiles.d |
| 44 | install -m 644 ${WORKDIR}/parsec-tmpfiles.conf ${D}${libdir}/tmpfiles.d |
| 45 | fi |
| 46 | |
| 47 | if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then |
| 48 | install -d ${D}${sysconfdir}/init.d |
| 49 | install -m 755 ${WORKDIR}/parsec_init ${D}${sysconfdir}/init.d/parsec |
| 50 | fi |
| 51 | } |
| 52 | |
| 53 | inherit useradd |
| 54 | USERADD_PACKAGES = "${PN}" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 55 | USERADD_PARAM:${PN} = "-r -g parsec -s /bin/false -d ${localstatedir}/lib/parsec parsec" |
| 56 | GROUPADD_PARAM:${PN} = "-r parsec" |
Andrew Geissler | f1e4406 | 2021-04-15 15:52:46 -0500 | [diff] [blame] | 57 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 58 | FILES:${PN} += " \ |
Andrew Geissler | f1e4406 | 2021-04-15 15:52:46 -0500 | [diff] [blame] | 59 | ${sysconfdir}/parsec/config.toml \ |
| 60 | ${libexecdir}/parsec/parsec \ |
| 61 | ${systemd_unitdir}/system/parsec.service \ |
| 62 | ${libdir}/tmpfiles.d/parsec-tmpfiles.conf \ |
| 63 | ${sysconfdir}/init.d/parsec \ |
| 64 | " |
| 65 | |
| 66 | require parsec-service_${PV}.inc |