SUMMARY = "Provides a Secure Storage"
DESCRIPTION = "The secure storage is a loopback mount that is encrypted. It protects data in rest"
AUTHOR = "Patrick Vogelaar"
LICENSE = "CLOSED"

SRC_URI = "\
    file://sec-storage-loopback.sh \
    file://secure-storage.service \
    "

S = "${WORKDIR}"

inherit systemd

FILES:${PN} += "\
    /usr/local/data/ \
    ${systemd_unitdir}/system \
    ${bindir}/sec-storage-loopback.sh \
    ${systemd_unitdir}/system/secure-storage.service \
    "

do_install() {
    install -d ${D}$/usr/local/data/
    install -d ${D}${bindir}
    install -m 0731 ${S}/sec-storage-loopback.sh ${D}${bindir}/sec-storage-loopback.sh

    install -d ${D}${systemd_unitdir}/system
    install -m 0644 ${S}/secure-storage.service ${D}${systemd_unitdir}/system
}

SYSTEMD_SERVICE:${PN} = "secure-storage.service"
SYSTEMD_AUTO_ENABLE = "enable"

RDEPENDS:${PN} += "cryptsetup"
