blob: d83a05689a64b4053e75335e1fab0864a9bb4abf [file] [log] [blame]
rjw1f884582022-01-06 17:20:42 +08001inherit workonsrc
2inherit pkgconfig
3inherit systemd
4
5DESCRIPTION = "SoftHSM Init"
6LICENSE = "MediaTekProprietary"
7LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7"
8APPS_SRC = "${TOPDIR}/../meta/meta-mediatek/recipes-support/softhsm-init"
9WORKONSRC = "${APPS_SRC}"
10
11#####Customization Start#####
12SOFTHSM_DATA_MOUNT_POINT = "/data"
13SOFTHSM_DATA_TOKEN_DIR = "/data/softhsm"
14SOFTHSM_DEFAULT_TOKEN_LABEL = "8516softhsm"
15SOFTHSM_DEFAULT_TOKEN_PIN = "85168516"
16SOFTHSM_DEFAULT_TOKEN_SO_PIN = "85168516"
17#####Customization End#####
18
19SYSTEMD_PACKAGES = "${PN}"
20SYSTEMD_SERVICE_${PN} = "softhsm-init.service"
21FILES_${PN} += "${systemd_unitdir}/system/softhsm-init.service"
22FILES_${PN} += "etc/softhsm-init.sh"
23FILES_${PN} += "etc/softhsm2.conf"
24
25do_install() {
26 install -d ${D}/etc
27 install -m 755 ${S}files/softhsm-init.sh ${D}/etc/softhsm-init.sh
28
29 install -d ${D}${systemd_system_unitdir}
30 install -m 0755 ${S}files/softhsm-init.service ${D}${systemd_system_unitdir}
31
32 sed -e 's%#SOFTHSM_DATA_MOUNT_POINT#%${SOFTHSM_DATA_MOUNT_POINT}%g' \
33 -i ${D}${systemd_system_unitdir}/softhsm-init.service
34
35 sed -e 's%#SOFTHSM_DATA_TOKEN_DIR#%${SOFTHSM_DATA_TOKEN_DIR}%g' \
36 -e 's%#SOFTHSM_DEFAULT_TOKEN_LABEL#%${SOFTHSM_DEFAULT_TOKEN_LABEL}%g' \
37 -e 's%#SOFTHSM_DEFAULT_TOKEN_PIN#%${SOFTHSM_DEFAULT_TOKEN_PIN}%g' \
38 -e 's%#SOFTHSM_DEFAULT_TOKEN_SO_PIN#%${SOFTHSM_DEFAULT_TOKEN_SO_PIN}%g' \
39 -i ${D}/etc/softhsm-init.sh
40
41 echo "objectstore.backend = file" > ${D}/etc/softhsm2.conf
42 echo "directories.tokendir = ${SOFTHSM_DATA_TOKEN_DIR}" >> ${D}/etc/softhsm2.conf
43}
44
45