I need this for my Raspberry PI Ubuntu Core installation. I want to be able to remove SD card after system boot. Now, if I remove it, all squashfs mounts disappear and system stops working properly. If snaps copied to RAM and started from there, I can unmount and remove SD card successfuly (as it works in TinyCore Linux, for example).
So, when I boot Ubuntu Core, it mounts all .snap files during boot as squashfs filesystems to /dev/loop devices from hard drive. I want to adjust this process. Before mounting, I want to copy snap files to ram drive and then mount them from RAM drive. So, during boot I want to create ram drive:
mkdir /mnt/ramdisk
mount -t tmpfs -o size=512m tmpfs /mnt/ramdisk
Then I want to copy all .snap files from /writable/system-data/var/lib/snapd/snaps
to /mnt/ramdisk
and then mount them to /dev/loop[0..9]
.
In which boot script can I insert my code for this?