In my pretty standard Yocto build I have the openssh included. Its configuration file, /etc/ssh/sshd_config, should naturally be different for production and development images (for example one would like root login on development image and not on production one).
The production and the development images are different recipes (.bb files) in recipes-core/images under my layer, which includes some other stuff as well.
In order to achieve customization for the sshd_config file, I've created recipes-connectivity/openssh directory under my layer with openssh_%.bbappend with just the following content:
SUMMARY = "OpenSSH configuration"
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
And in the files directory, I've got my own sshd_conf. This works fine, my file is used instead of openssh's default one. But how can I have, say, two separate files that will affect the two different resulting rootfs's?
The closest I've seen is this question, and this answer seems just too simple to be true. I've tried using my image names for folders, but all I got is the default conf file in both resulting image builds. The second answer seams reasonable, but AFAIK I can't replace a file coming from other recipe (please correct me if I'm wrong), so probably that was quite a specific case for the OP that worked.
Running a post-install script is not an option, since the rootfs is read-only on the target.
Studying the _append_xxxx stuff in the manual did not push me to the right direction as well.
Hope someone could share some experience on that, as this seems a pretty straightforward issue that should have some built-in solution.
Thanks.
IS_PROD = "1", then you can use something like this in your image recipe:SRC_URI += "${@ "file://conf1" if bb.utils.to_boolean(d.getVar('IS_PROD')) else "file://conf2" }"pkg_postinst_${PN}() {}which replaces the file, and add them in the different image recipes? Will try that. Thanks for your suggestions.do_install()to rename conf1 or conf2 insshd_config. You can also tweak a default file withecho/sedin aROOTFS_POSTPROCESS_COMMAND