Re: Possible to ignore a missing file in recipe without error?

Josef Holzmayr


On 11. Feb 2022, at 20:03, Howard <howard.egan@...> wrote:


I have a simple recipe that installs a few miscellaneous files, one of the files may or may not be present and in reality that's ok for the moment, but I don't see a way to do things in a recipe based on the presence or absence of a file. 

The real question is: what is the condition? It must be something that is constant across all of the build. And if can only come from either a .conf file or the environment, otherwise it would not be visible in the recipe.

For example:


FILESEXTRAPATHS_prepend := "${THISDIR}/files:"

# always present file
SRC_URI += "file://myconfig.config"

# sometimes present file - is there a way to conditionally do this statement
SRC_URI += "file://myOtherConfig.config"

A possible approach would be only appending depending on a specific DISTRO_FLAG, via bb.utils.contains. I have done something similar at

But again, it depends on the exact use case.


do_install() {
    install -d ${D}${sysconfdir}
    install -m 0755 ${WORKDIR}/myconfig.config ${D}${sysconfdir}
    #same here
    install -m 0755 ${WORKDIR}/myOtherConfig.config ${D}${sysconfdir}


FILES_${PN} += " ${sysconfdir}/myconfig.config "
#same here
FILES_${PN} += " ${sysconfdir}/myOtherConfig.config "

Many thanks

Join to automatically receive all group messages.