blob: 5f7a99b4267acf02e2b6009a13abeeea0b7d6257 [file] [log] [blame]
Andrew Geisslerf1e44062021-04-15 15:52:46 -05001SUMMARY = "Platform AbstRaction for SECurity Daemon"
2HOMEPAGE = "https://github.com/parallaxsecond/parsec"
3LICENSE = "Apache-2.0"
4
5inherit cargo
6
7SRC_URI += "crate://crates.io/parsec-service/${PV} \
8 file://parsec_init \
9 file://systemd.patch \
10 file://parsec-tmpfiles.conf \
11"
12
Andrew Geissler59125e02021-07-23 12:56:22 -040013DEPENDS = "tpm2-tss clang-native"
Andrew Geisslerf1e44062021-04-15 15:52:46 -050014
15CARGO_BUILD_FLAGS += " --features all-providers,cryptoki/generate-bindings,tss-esapi/generate-bindings"
16
17inherit systemd
Patrick Williams213cb262021-08-07 19:21:33 -050018SYSTEMD_SERVICE:${PN} = "parsec.service"
Andrew Geisslerf1e44062021-04-15 15:52:46 -050019
20inherit update-rc.d
21INITSCRIPT_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
25PARSEC_CONFIG ?= "${S}/config.toml"
26
Patrick Williams213cb262021-08-07 19:21:33 -050027do_install:append () {
Andrew Geisslerf1e44062021-04-15 15:52:46 -050028 # 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
53inherit useradd
54USERADD_PACKAGES = "${PN}"
Patrick Williams213cb262021-08-07 19:21:33 -050055USERADD_PARAM:${PN} = "-r -g parsec -s /bin/false -d ${localstatedir}/lib/parsec parsec"
56GROUPADD_PARAM:${PN} = "-r parsec"
Andrew Geisslerf1e44062021-04-15 15:52:46 -050057
Patrick Williams213cb262021-08-07 19:21:33 -050058FILES:${PN} += " \
Andrew Geisslerf1e44062021-04-15 15:52:46 -050059 ${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
66require parsec-service_${PV}.inc