Custom Mender Identiy with mender-convert

We use mender-convert with the raspbian image and copied before an own mender-device-identity script to the image. After mender-convert the script is replaced with the default mender-device-identity script. Is there a possibility to keep the mender-device-identity script or how can this be done?

I’ll let @mirzak comment on mechanisms to support this specific issue however in general, I think it is better to do all Mender-based configurations after running mender-convert. I think there may be issues such as this one if you are trying to prepopulate the configuration files.

I think changing those things AFTER mender-convert will not work, since after mender-convert there are two artefacts: the sdimg (here we could actually still change content) and the mender-artefact to be uploaded to (here we cannot change the content anymore).

Therefore it feels like a bug that the mender-device-identity script is overwritten by mender-convert if it is already present in the source-image.

I might lean to agreeing to this, but I believe that there is a bigger problem with the current “model”. Yes one could simply add a check not to install files if they are already there. But this would then need to apply to “more files” then mender-device-identity, and it quickly gets a out of hand.

This is something that would be quite easy to accomplish using the upcoming mender-convert tool (which received an overhaul for reasons like this),

Here a “MIDDLE” step is added (which IMO would be the correct location to do this, not BEFORE and AFTER), where one is able to provide rootfs overlays and this would be the location to provide e.g a custom mender-device-identity file.