DESCRIPTION = "Example that shows how services can be started by using systemd unit files"
SECTION = "examples"
DEPENDS = ""
LICENSE = "CLOSED"

FILESEXTRAPATHS:prepend := "${THISDIR}/files:"

SRC_URI = " file://demo_service_1.sh \
            file://demoservice1.service  \
            file://demo_service_2.sh \
            file://demoservice2.service  \
            file://demo_service_3.sh \
            file://demoservice3.service  \
"

inherit systemd

SYSTEMD_SERVICE:${PN} += "demoservice1.service"
SYSTEMD_SERVICE:${PN} += "demoservice2.service"
SYSTEMD_SERVICE:${PN} += "demoservice3.service"
SYSTEMD_AUTO_ENABLE = "enable"

do_install(){
    install -d ${D}${bindir}
    install -m 0777 ${WORKDIR}/demo_service_1.sh ${D}${bindir}
    install -m 0777 ${WORKDIR}/demo_service_2.sh ${D}${bindir}
    install -m 0777 ${WORKDIR}/demo_service_3.sh ${D}${bindir}
    install -d ${D}${systemd_unitdir}/system
    install -m 0644 ${WORKDIR}/demoservice1.service ${D}${systemd_unitdir}/system
    install -m 0644 ${WORKDIR}/demoservice2.service ${D}${systemd_unitdir}/system
    install -m 0644 ${WORKDIR}/demoservice3.service ${D}${systemd_unitdir}/system
}

FILES:${PN} += " ${systemd_unitdir}/system/demoservice*.service ${bindir}/demo_service_*.sh"
