Ensure KUKSA.val JWT certificate gets installed
[AGL/meta-agl-demo.git] / recipes-connectivity / kuksa-val / kuksa-certificates-agl.bb
1 SUMMARY = "AGL certificates for KUKSA.val, the KUKSA Vehicle Abstraction Layer"
2 HOMEPAGE = "https://github.com/eclipse/kuksa.val"
3 BUGTRACKER = "https://github.com/eclipse/kuksa.val/issues"
4
5 LICENSE = "MIT"
6 LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
7
8 SRC_URI = "file://CA.pem \
9            file://Client.key \
10            file://Client.pem \
11            file://Server.key \
12            file://Server.pem \
13            file://jwt.key.pub \
14 "
15
16 inherit allarch useradd
17
18 USERADD_PACKAGES = "${PN}-server"
19 USERADDEXTENSION = "useradd-staticids"
20 GROUPADD_PARAM:${PN}-server = "-g 900 kuksa ;"
21
22 do_install() {
23     # Install replacement CA certificate, server key + certificate,
24     # and client key + certificate.
25     # These are AGL specific versions generated using a tweaked
26     # genCerts.sh script to have different expiry dates than the
27     # upstream defaults, and use AGL as the organization.
28     install -d ${D}${sysconfdir}/kuksa-val/
29     install -m 0644 ${WORKDIR}/CA.pem ${D}${sysconfdir}/kuksa-val/
30     install -m 0640 -g 900 ${WORKDIR}/Server.key ${D}${sysconfdir}/kuksa-val/
31     install -m 0640 -g 900 ${WORKDIR}/Server.pem ${D}${sysconfdir}/kuksa-val/
32     install -m 0644 -g 900 ${WORKDIR}/jwt.key.pub ${D}${sysconfdir}/kuksa-val/
33     install -m 0644 ${WORKDIR}/Client.key ${D}${sysconfdir}/kuksa-val/
34     install -m 0644 ${WORKDIR}/Client.pem ${D}${sysconfdir}/kuksa-val/
35 }
36
37 PACKAGE_BEFORE_PN += "${PN}-ca ${PN}-server ${PN}-client"
38
39 FILES:${PN}-ca = " \
40     ${sysconfdir}/kuksa-val/CA.pem \
41 "
42 RPROVIDES:${PN}-ca += "kuksa-val-certificates-ca"
43
44 FILES:${PN}-server = " \
45     ${sysconfdir}/kuksa-val/Server.key \
46     ${sysconfdir}/kuksa-val/Server.pem \
47     ${sysconfdir}/kuksa-val/jwt.key.pub \
48 "
49 RPROVIDES:${PN}-server += "kuksa-val-certificates-server"
50 RDEPENDS:${PN}-server += "${PN}-ca"
51
52 FILES:${PN}-client = " \
53     ${sysconfdir}/kuksa-val/Client.key \
54     ${sysconfdir}/kuksa-val/Client.pem \
55 "
56 RPROVIDES:${PN}-client += "kuksa-val-certificates-client"
57 RDEPENDS:${PN}-client += "${PN}-ca"
58
59 ALLOW_EMPTY:${PN} = "1"
60
61 RDEPENDS:${PN} += "${PN}-ca ${PN}-server ${PN}-client"