I want to pass images to Mender to update the entire device, but there’s one .json file that stores the user’s configuration. I want to preserve this file and place it in the same place after the update. Even if there’s not an explicit way of doing this, is it possible to create a script to copy the file to some temporary location and move it into the new version after the system update?
There are basically two ways to achieve this:
- Permanently store the JSON file in the /data partition. This will ensure it is never touched by a full image update.
- Use state scripts to backup and restore the file. You can use an ArifactInstall_Enter script to back up the existing one and an ArtifactCommit_Enter script to restore the backup into the new rootfs.
For the state scripts, would I backup the file to the /data partition and restore it from there, or is there some place I can put files to be accessed by different state scripts that won’t be modified during the system update?
Using the /data partition is probably the right approach.