Search code examples
linux-kernelembeddedembedded-linuxyoctoopenembedded

Replace mosquitto.conf file with bbappend?


I have a layer meta-test where I have created a mosquitto_%.bbappend for customizing the default mosquitto.conf file which is created by the meta-openembedded layer's recipe. My bbappend file looks like this:

FILESEXTRAPATHS_prepend := "${THISDIR}/files:"  
SRC_URI += "file://mosquitto.conf"

The image builds without error but the mosquitto.conf is not replaced. What I have observed is the above process replaces mosquitto.conf only if it present in any of the main layers but since the mosquitto_1.5.1.bb file only installs this, and since this file is not present in any layers,how do I overwrite this file? This file gets generated in /etc/mosquitto directory. This is the bitbake file I want to overwrite: http://cgit.openembedded.org/meta-openembedded/tree/meta-networking/recipes-connectivity/mosquitto/mosquitto_1.5.1.bb?h=thud


Solution

  • In addition to Nayfe's answer I want to add this. I solved it by the task do_install_append where I have made some changes compared to the meta-openembedded's mosquitto recipe. I have moved my mosquitto.conf from the working directory to the destination directory which replaces the original conf file.

     do_install_append() {
    
         install -d ${D}${sysconfdir}/mosquitto
         install -m 0644 ${WORKDIR}/mosquitto.conf \
                    ${D}${sysconfdir}/mosquitto/mosquitto.conf
     }