blob: 0e149558c0346bff3d69f74f7b7170f6b0c3dbd2 [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
13DEPENDS = "tpm2-tss"
14TOOLCHAIN = "clang"
15
16CARGO_BUILD_FLAGS += " --features all-providers,cryptoki/generate-bindings,tss-esapi/generate-bindings"
17
18inherit systemd
19SYSTEMD_SERVICE_${PN} = "parsec.service"
20
21inherit update-rc.d
22INITSCRIPT_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
26PARSEC_CONFIG ?= "${S}/config.toml"
27
28do_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
54inherit useradd
55USERADD_PACKAGES = "${PN}"
56USERADD_PARAM_${PN} = "-r -g parsec -s /bin/false -d ${localstatedir}/lib/parsec parsec"
57GROUPADD_PARAM_${PN} = "-r parsec"
58
59FILES_${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
67require parsec-service_${PV}.inc