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