Hi, I wan’t to create some files and folders in $SNAP_USER_DATA, that are needed to run my app, using the install hook. Now I found out, if I make something like mkdir -p $SNAP_USER_DATA/myfolder that will createthe folder under /root (/root/snap/mysnap/current/myfolder), but not in the users home directory! How can I accomplish that? Even doing snap install without sudo creates the files and folders under root…
you can not use a hook for this (beyond the technical issues that brings, how would your system even know at install time which user will potentially use the app), use a command-chain
wrapper script instead for setting up per-user environment bits …
Mhh, okay, thanks for the hint. And thanks for the ultra-quick reply
For install that might work.
I will also have to reset some files after a refresh, but only once. I could just create a .resfreshed file somewhere like $SNAP_DATA to signal to the snap, that it has to fetch the necessary files, but, beeing run as normal user, I would not be able to remove the .refreshed file afterwards without sudo.
Any idea, how I can find out if the snap was refreshed?
$ snap run --shell htop -c 'env | grep SNAP_REVISION'
SNAP_REVISION=3390
just store the revision on first start in SNAP_USER_DATA … if it changed, take action …
(there are probably a million other (and potentially cleaner) ways )