Update the config data with snap update

Hi guys,

Is there a way to replace the config files stored in the var/snap/xwiki/<new_revision>/ with the config files in the var/snap/xwiki/<old_revison>/ when the user updates the snap with

sudo snap update xwiki

this should happen automatically, snapd does a full copy of “old_revision” to “new_revision” during an update before the newly updated service is started … (the snap also fully loses access to “old_revision” during this process through a switch of the confinement rules, which is why it is essential that the service gets stopped and restarted during updates)

1 Like

I also have a install hook that copies certain files in the $SNAP_DATA will this cause an issue while updating since the “new_revision” config files might be replaced while the hook runs ?

not from an install hook, that actually only gets run at initial installation i think …

i’d also consider using $SNAP_COMMON instead of $SNAP_DATA since this does not get touched during updates …

1 Like