Snap Impression (by quqi99)

来源:互联网 发布:男士皮鞋品牌 知乎 编辑:程序博客网 时间:2024/06/15 06:34

版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本版权声明 (http://blog.csdn.net/quqi99)

Snap一是把应用隔离在沙盒之内,保证不同应用之间或者应用不同版本之间完全在文件系统上进行隔离,这样就彻底解决应用之间升级互相影响的问题(依赖全部打包,并且通过mount namespace与发行版的文件隔离, 所以snap应用可以安装同样一个软件的不同版本);二是通过引入应用程序运行时的runtime接口,保证了系统和应用之间有一个稳定的接口,从侧面也保证了系统和应用之间的依赖分离。理论上一个snap应用可以安装到任何一个Linux的发行版上,因为它不依赖于操作系统及其发布版本。

Basic Usage

; snapcraft equals ‘apt-get for github’
sudo apt install snapd snapcraft
snap find hello
; sudo snap remove hello
sudo snap install hello
sudo snap install hello –beta –devmode
snap list
hello
sudo snap refresh hello –beta #Set up update automatically, channels can be: stable, candidate, beta, edge
snap info hello

Build Your Own Snap

snapcraft init
$ cat snap/snapcraft.yaml
name: hello
version: “2.10”
summary: GNU Hello, the “hello world” snap
description: GNU Hello prints a friendly greeting
confinement: strict
apps:
hello:
command: hello
parts:
gnu-hello:
plugin: autotools
source: http://ftp.gnu.org/gnu/hello/hello-2.10.tar.gz

snapcraft
$ ls
hello_2.10_amd64.snap parts prime snap stage
sudo snap install ./hello_2.10_amd64.snap –dangerous

Code

git clone https://github.com/snapcore/snapd.git

Reference

[1] https://snapcraft.io/docs/core/
[2] https://snapcraft.io/docs/build-snaps/

原创粉丝点击