Updating the project

Hello
I would like to find out how to make it so that when updating my snap package, it performs a new update on top of the old one. It’s just that my project is a directory that the user works with, and if I added changes to the configuration files, then these files were updated during the releases, but the files that the user himself added remained

Can’t anyone answer my question?

Where in your snap are you storing these files? It sounds like your snap maybe should copy these files from $SNAP (which is read-only and will change to the new version of your snap every time your snap refreshes) to somewhere like $SNAP_USER_COMMON, which will persist from one revision to another with the same set of files that were there already

The catalog is downloaded to the source folder snap
image
image
Here is my snapcraft. yaml
image

I’m not sure if I understood the problem, could you re-explain it in a different way? In what part of the filesystem are the user files currently stored? Are the changes in configuration files made by the user or are they part of a new version of the package?

The entire directory is stored in the snap root and is read-only.
I’m trying to figure out how to make some files and folders readable and others writable.
And also when updating the package to a new version, the changes that the user made to the old directory were transferred to the new one.

The snap package contents are read-only, and there’s no way to change that. User data, however, may be stored in separate areas in the filesystem. Maybe this discussion could help?

Here is my project when installing it, it is installed only in the root of snap, but since the files in the root directory are read-only, the user cannot work with snap. How can I make it so that the user can work with these directories ?

@geor444 re-read cmatsuoka’s comment immediately above yours:

You cannot modify a snap filesystem after it has been installed. This is a planned, and designed, feature. If you need the user to be able to edit files those must be created or copied from the snap at a user-writable location. The approved paths are stored in the environment variables $SNAP_USER_DATA and $SNAP_USER_COMMON, which are readable by your application at run-time so it can determine where the user’s files are located.

The problem is that I don’t understand how to do this, and there is no example of how it works in the documentation

see my answer in this thread how to copy files from the read-only space to a writable area using an install hook:

I used the example suggested in the link, but when building the package, I get the following error
image

this two lines tell me nothing, can you post the full log ? and also describe what you did different from the example (it should be an install hook in the snap/hooks/ directory nothing in your snapcraft.yaml or some such)

in the directory of my project, I created the file “reg. conf”
The following is written outside
image
And in snapcraft.yaml added a dedicated chunk
image

drop the apps: changes from your snapcraft.yaml for now and leave it like it was … (this was really specific to the app in the other thread)

lets do one step at a time :slight_smile:

only add the install hook to the working version of your snap you had, build your snap, install it and check /var/snap/qspro/common after install … you should find qspro/red.conf in there …

Now I need to remove a piece from apps, and build a project without it?

you had your snap building and installable before.
go back to that state, then create snap/hooks/install like described in your project dir and build it …

I built a project, there is no reg.config file in common

did you add the install hook to it yet ?

do you by chance have your project online somewhere and also, if you post logs, please copy/paste the full log not screenshots and not single lines (if it is very long, use paste.ubuntu.com or pastebin.com or some other paste service and link it here)

in my red. conf there are only two lines that I sent
snapcraft.yaml also sent a screenshot of the entire file