# File in the swupdate subdirectory of this recipe should overwrite the
# same file in meta-swupdate
FILESEXTRAPATHS:prepend := "${THISDIR}/swupdate:"
RDEPENDS:${PN}:append = " efibootguard"

SRC_URI += "file://webserver-config.sh \
            file://sw-collections-config.sh \
            file://0001-fs-add-support-to-create-FAT16-partition.patch \
            "

# 0001-fs-add-support-to-create-FAT16-partition.patch depends on the
# mkfs.fat binary
RDEPENDS:${PN} += "dosfstools"

# Don't use /www as the web root
wwwdir = "/usr/share/swupdate-www"

FILES:${PN} += " \
    ${SWUPDATE_SW_VERSIONS_FILE} \
    ${SWUPDATE_HW_COMPATIBILITY_FILE} \
    ${libdir}/swupdate/conf.d/sw-collections-config.sh \
"

FILES:${PN}-www += " \
    ${libdir}/swupdate/conf.d/webserver-config.sh \
"

do_install:append() {
    # Probably replace revision with the value of the device tree
    install -m 755 ${WORKDIR}/webserver-config.sh ${D}${libdir}/swupdate/conf.d/

    install -m 755 ${WORKDIR}/sw-collections-config.sh ${D}${libdir}/swupdate/conf.d/
    echo "${MACHINE} 1.0" > ${D}${SWUPDATE_HW_COMPATIBILITY_FILE}
}

PR = "r2"