Updating the project

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

i’m not sure i understand, did you create the install hook as snap/hooks/install ?

what is the red.conf file here in that context ?

I understand rc. conf this should be my installhook, but I probably don’t quite understand how to correctly prescribe it so that it doesn’t work

no, your install hook must be called “install” and needs to be an executable script inside the snap/hooks/ folder in your project dir

do I need to create this directory manually inside my project?

yes, you want the hooks dir next to your snapcraft.yaml in teh snap/ directory … then create the script inside that dir and call it “install” … do not forget to make it executable …

now re-create your .snap and during install it will run the install hook you created …