A snap:
is a squashFS filesystem containing your app code and asnap.yamlfile containing specific metadata. It has a read-only file-system and, once installed, a writable area.
is self-contained. It bundles most of the libraries and runtimes it needs and can be updated and reverted without affecting the rest of the system.
is confined from the OS and other apps through security mechanisms, but can exchange content and functions with other snaps according to fine-grained policies controlled by the user and the OS defaults.
Details please refer to: https://docs.snapcraft.io/snaps/metadata
1. 构建arm 的snap 包
snapcraft
2. 下载指定平台的image
UBUNTU_STORE_ARCH=armhf snap download sth
UBUNTU_STORE_ARCH=arm64 snap download sth
3. system user
你不能在一个已经被管理的设备上再创建一个user。只能在一个未被管理的device 上创建一个system user
https://docs.ubuntu.com/core/en/guides/manage-devices/?_ga=2.226522645.905063160.1536053910-560405323.1510796397
auto-import.assert 可以防置在仍何可以挂载的地方。该方式创建的用户名,不能叫root。
4. 生成ubuntu core image
ubuntu-image -c stable --image-size 2G --extra-snaps uboot_2016-03_armhf.snap --extra-snaps kernel_4.4.19-gff01773757_armhf.snap --extra-snaps core_5331.snap -O rsb4220.img rsb4220.model
5. 解压/压缩initrd
解压: xz -dc initrd.img | cpio -id
压缩: find . | cpio --create --format=newc | lzma > ../initrd.img
6. 创建model
https://docs.ubuntu.com/core/en/guides/build-device/image-building
7. interfaces 只是snap 世界的概念。
shell 命令行从不涉及interface 的概念。由于snapd 要对snap程序在执行前进行检查,所以snap 程序执行会有较长的时延。
8. 使用snap connect plugin slot 后,链接属性永久保存,除非你使用snap disconnect 将其删除。
We strongly recommend using an Ubuntu 16.04 host, VM or container for this guide. While it is possible to use newer releases of Ubuntu, or other Linux distributions, this may result in incorrect libraries being pulled into the build.
9. 创建一个snap app
https://tutorials.ubuntu.com/tutorial/build-a-nodejs-service?backURL=https://docs.snapcraft.io/build-snaps/metadata#4
https://docs.snapcraft.io/build-snaps/builders
10. 安装一个本地snap
snap install --dangerous xx.snap
https://forum.snapcraft.io/t/security-policy-and-sandboxing/554
11. udisk2
https://docs.ubuntu.com/core/en/stacks/disk/udisks2/docs/installation
网友评论