I’m building an application that needs a configuration file. The configuration file shouldn’t be versioned and created on installation only. I believe putting it in SNAP_COMMON makes the most sense but I’m not sure how to get there. Does anyone have experience with this.
I haven’t attempted to place files in SNAP_COMMON specifically, but to place some files in otherlocation I’ve used a configure hook that places the files on install/update of the snap. My configure hook was a simple shell script name configure in snap/hooks/ that echoes a few lines to a file on install.
You can’t do it via snapcraft directly because that is building up what is in the read-only squashfs (that said, perhaps someone created a part for this-- I’m not sure).
You should be able to do it via an install hook. I’ve also done it by adjusting my wrapper script to put it in place if it didn’t already exist.