blob: d83a05689a64b4053e75335e1fab0864a9bb4abf [file] [log] [blame]
inherit workonsrc
inherit pkgconfig
inherit systemd
DESCRIPTION = "SoftHSM Init"
LICENSE = "MediaTekProprietary"
LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7"
APPS_SRC = "${TOPDIR}/../meta/meta-mediatek/recipes-support/softhsm-init"
WORKONSRC = "${APPS_SRC}"
#####Customization Start#####
SOFTHSM_DATA_MOUNT_POINT = "/data"
SOFTHSM_DATA_TOKEN_DIR = "/data/softhsm"
SOFTHSM_DEFAULT_TOKEN_LABEL = "8516softhsm"
SOFTHSM_DEFAULT_TOKEN_PIN = "85168516"
SOFTHSM_DEFAULT_TOKEN_SO_PIN = "85168516"
#####Customization End#####
SYSTEMD_PACKAGES = "${PN}"
SYSTEMD_SERVICE_${PN} = "softhsm-init.service"
FILES_${PN} += "${systemd_unitdir}/system/softhsm-init.service"
FILES_${PN} += "etc/softhsm-init.sh"
FILES_${PN} += "etc/softhsm2.conf"
do_install() {
install -d ${D}/etc
install -m 755 ${S}files/softhsm-init.sh ${D}/etc/softhsm-init.sh
install -d ${D}${systemd_system_unitdir}
install -m 0755 ${S}files/softhsm-init.service ${D}${systemd_system_unitdir}
sed -e 's%#SOFTHSM_DATA_MOUNT_POINT#%${SOFTHSM_DATA_MOUNT_POINT}%g' \
-i ${D}${systemd_system_unitdir}/softhsm-init.service
sed -e 's%#SOFTHSM_DATA_TOKEN_DIR#%${SOFTHSM_DATA_TOKEN_DIR}%g' \
-e 's%#SOFTHSM_DEFAULT_TOKEN_LABEL#%${SOFTHSM_DEFAULT_TOKEN_LABEL}%g' \
-e 's%#SOFTHSM_DEFAULT_TOKEN_PIN#%${SOFTHSM_DEFAULT_TOKEN_PIN}%g' \
-e 's%#SOFTHSM_DEFAULT_TOKEN_SO_PIN#%${SOFTHSM_DEFAULT_TOKEN_SO_PIN}%g' \
-i ${D}/etc/softhsm-init.sh
echo "objectstore.backend = file" > ${D}/etc/softhsm2.conf
echo "directories.tokendir = ${SOFTHSM_DATA_TOKEN_DIR}" >> ${D}/etc/softhsm2.conf
}