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

SRC_URI += " \
		file://restore-bios.conf \
		file://restore-bios-version.sh \
		file://restore-cpld.conf \
		file://restore-cpld-version.sh \
		file://restore-fb-cpld.conf \
		file://restore-fb-cpld-version.sh \
	    "

SRC_URI += " \
		file://0001-Add-fan-board-cpld-for-software-manager.patch \
		file://0001-Add-ReleaseDate-for-Software-interface.patch \
		file://0001-Support-applyoption-and-updatetarger-parameter.patch \
		"

PACKAGECONFIG[async_update] = "-Dasync-update=enabled, -Dasync-update=disabled"

PACKAGECONFIG:append = " \
	async_update \
"

SYSTEMD_SERVICE:${PN}-updater += "${@bb.utils.contains('PACKAGECONFIG', 'async_update', 'obmc-async-update.service', '', d)}"

FILES:${PN}:append = " ${systemd_system_unitdir}/xyz.openbmc_project.Software.BMC.Updater.service.d/restore-bios.conf"
FILES:${PN}:append = " ${systemd_system_unitdir}/xyz.openbmc_project.Software.BMC.Updater.service.d/restore-cpld.conf"
FILES:${PN}:append = " ${systemd_system_unitdir}/xyz.openbmc_project.Software.BMC.Updater.service.d/restore-fb-cpld.conf"

do_install:append() {
	install -d ${D}${systemd_system_unitdir}/xyz.openbmc_project.Software.BMC.Updater.service.d
    install -m 0644 ${WORKDIR}/restore-bios.conf ${D}${systemd_system_unitdir}/xyz.openbmc_project.Software.BMC.Updater.service.d/
	install -m 0644 ${WORKDIR}/restore-cpld.conf ${D}${systemd_system_unitdir}/xyz.openbmc_project.Software.BMC.Updater.service.d/
	install -m 0644 ${WORKDIR}/restore-fb-cpld.conf ${D}${systemd_system_unitdir}/xyz.openbmc_project.Software.BMC.Updater.service.d/
	
	install -d ${D}${bindir}
	install -m 0755 ${WORKDIR}/restore-bios-version.sh ${D}${bindir}
	install -m 0755 ${WORKDIR}/restore-cpld-version.sh ${D}${bindir}/
	install -m 0755 ${WORKDIR}/restore-fb-cpld-version.sh ${D}${bindir}/
}