snap core
中包含了常用的系统库, 其他snap程序依赖这些库
snap core
启动时会mount
到/snap/corexx/current
目录, 实际上就是把/var/snapd/snaps/corexx.snap
文件挂载到该目录
snap core
会构建一个基础的chroot
环境, 其他snap
应用启动时的根目录就是mount
到snap core
的挂载目录
使用如下命令, 把本地的/home/user/xxx
目录绑定到snap
中
mount --bind /home/user/xxx /snap/corexx/current/mnt/xxx
这样, snap
中的/mnt/xxx
目录就绑定到了本地的/home/user/xxx
目录, 并且是可以读写的
参考资料
https://snapcraft.io/docs/security-sandboxing
https://snapcraft.io/docs/snap-confinement
https://www.ubuntukylin.com/news/666-cn.html
https://zh.wikipedia.org/zh-cn/SquashFS
详解 Ubuntu snap 包的制作过程