标签:
Canonical公司于最近2016年4月发布了一个新的16.04系统,并且这个系统是长期支持版(Long Term Support - LTS).它一如既往地支持debian安装包,但同时它也支持最新的snap安装包.snap安装包是Canonical公司最新发布的一种安装包的格式.更多的信息可以在我们的官方开发者网站:https://developer.ubuntu.com/en/desktop/或http://snapcraft.io/查看.
从上面的图中,我们可以看出来在16.04的桌面中支持两种格式的安装包:snap及debian.另外我们可以看出,snap包每个安装的应用都是自成一体:包含应用运行所需要的任何依赖(dependencies);同时我们可以看出每个应用都是互相隔离的.和debian包相比较,我们可以看出来每个debian应用的安装依赖于其它包的安装;debian应用之间可以互相访问而造成安全问题;删除其中的一个debian应用可能导致其它的应用不可以正常运行.相比较而言,不同的snap应用可以安装同样一个软件的不同版本(比如一个安装python 2.7,另外一个应用安装python 3.3)而不造成任何的干扰.从理论上讲,一个snap应用可以安装到任何一个Linux的发行版上,因为它不依赖于操作系统及其发布版本.这对于应用的维护来说是非常好的.
Canonical公司目前正在向全社区把应用移植成为snap包,并最终把操作系统变为ubuntu core系统,从而打造最安全的操作系统及良好的应用维护.
$ sudo apt update $ sudo apt install snapd $ sudo apt install snapcraft
$ sudo snap install ubuntu-calculator-app $ ubuntu-calculator-app.calculator
https://code.launchpad.net/~dpm/ubuntu-calendar-app/snap-all-things
liuxg@liuxg:~$ snap find calculator Name Version Developer Notes Summary ubuntu-calculator-app 2.1+snap3 ubuntucoredev - Ubuntu Calculator application for the Unity 7 desktop
liuxg@liuxg:~$ snap find Name Version Developer Notes Summary ab 1.0 snappy-test - Test snap with shortest name ag-mcphail 1.0.1 njmcphail - The Silver Searcher - mcphail's build and upstream git version alsa-utils 1.1.0-1 woodrow - Utilities for configuring and using ALSA apktool 2.1.1 ligboy - A tool for reverse engineering 3rd party, closed, binary Android apps. ...
liuxg@liuxg:~$ snap find | grep hello hello 2.10 canonical - GNU Hello, the "hello world" snap hello-bluet 0.1 bluet - Qt Hello World example hello-huge 1.0 noise - a really big snap hello-snap 0.01 muhammad - GNU hello-snap, the "Hello, Snap!" snap
liuxg@liuxg:~$ snap list Name Version Rev Developer Notes hello-world 6.1 26 canonical - rssreader 1.0 x1 devmode rssreader-app 1.0 x2 - snaptest 1 x1 devmode snaptest-app 1 x3 devmode ubuntu-calculator-app 2.1+snap3 5 ubuntucoredev - ubuntu-core 16.04+20160531.11-56 122 canonical - webcam-webui 1 x1 -
liuxg@liuxg:~$ sudo snap remove ubuntu-calculator-app [sudo] password for liuxg: Done
liuxg@liuxg:~$ snap list Name Version Rev Developer Notes hello-world 6.1 26 canonical - rssreader 1.0 x1 devmode rssreader-app 1.0 x2 - snaptest 1 x1 devmode snaptest-app 1 x3 devmode ubuntu-core 16.04+20160531.11-56 122 canonical - webcam-webui 1 x1显然我们再也找不到ubuntu-calculator-app应用了.
liuxg@liuxg:~$ snap list Name Version Rev Developer Notes hello-world 6.1 26 canonical - rssreader 1.0 x1 devmode rssreader-app 1.0 x2 - snaptest 1 x1 devmode snaptest-app 1 x3 devmode ubuntu-calculator-app 2.1+snap3 5 ubuntucoredev - ubuntu-core 16.04+20160531.11-56 122 canonical - webcam-webui 1 x1 -
$ snap --help # Or use 'snap <command> --help' for help on a specific command
liuxg@liuxg:/var/lib/snapd/snaps$ ls hello-world_26.snap rssreader_x1.snap snaptest-app_x3.snap ubuntu-core_122.snap rssreader-app_x1.snap snaptest-app_x1.snap snaptest_x1.snap webcam-webui_x1.snap rssreader-app_x2.snap snaptest-app_x2.snap ubuntu-calculator-app_5.snap
liuxg@liuxg:~$ mount | grep calculator /var/lib/snapd/snaps/ubuntu-calculator-app_5.snap on /snap/ubuntu-calculator-app/5 type squashfs (ro,relatime)
liuxg@liuxg:/snap/ubuntu-calculator-app/5$ tree -L 2 . ├── bin │ └── calculator ├── build │ └── ubuntu-calculator-app ├── command-calculator.wrapper ├── etc │ ├── apparmor.d │ ├── dbus-1 │ ├── default │ ├── drirc │ ├── fonts │ ├── gps.conf │ ├── gss │ ├── init │ ├── init.d │ ├── ldap │ ├── pki │ ├── pulse │ ├── ucf.conf │ ├── X11 │ └── xdg ├── lib │ ├── systemd │ └── x86_64-linux-gnu ├── meta │ ├── gui │ └── snap.yaml ├── usr │ ├── bin │ ├── lib │ └── share └── var └── lib
-rw-r--r-- 1 liuxg liuxg 122M 7月 12 12:00 ubuntu-calculator-app_2.1+snap3_amd64.snap
$ unsquashfs -l ubuntu-calculator-app_2.1+snap3_amd64.snap | less
squashfs-root squashfs-root/bin squashfs-root/bin/calculator squashfs-root/command-calculator.wrapper squashfs-root/etc squashfs-root/etc/X11 squashfs-root/etc/X11/Xreset squashfs-root/etc/X11/Xreset.d squashfs-root/etc/X11/Xreset.d/README squashfs-root/etc/X11/Xresources squashfs-root/etc/X11/Xresources/x11-common squashfs-root/etc/X11/Xsession squashfs-root/etc/X11/Xsession.d squashfs-root/etc/X11/Xsession.d/20x11-common_process-args squashfs-root/etc/X11/Xsession.d/30x11-common_xresources squashfs-root/etc/X11/Xsession.d/35x11-common_xhost-local squashfs-root/etc/X11/Xsession.d/40x11-common_xsessionrc squashfs-root/etc/X11/Xsession.d/50x11-common_determine-startup squashfs-root/etc/X11/Xsession.d/60x11-common_localhost squashfs-root/etc/X11/Xsession.d/60x11-common_xdg_path ...
$ unsquashfs ubuntu-calculator-app_2.1+snap3_amd64.snap $ cd cd squashfs-root # Hack hack hack $ snapcraft snap
375M ./ubuntu-calculator-app/
liuxg@liuxg:~$ snap interfaces Slot Plug :camera - :cups-control - :firewall-control - :gsettings - :home rssreader-app,snaptest-app :locale-control - :log-observe - :modem-manager - :mount-observe - :network - :network-bind webcam-webui :network-control - :network-manager - :network-observe - :opengl rssreader-app,snaptest-app,ubuntu-calculator-app :optical-drive - :ppp - :pulseaudio - :snapd-control - :system-observe - :timeserver-control - :timezone-control - :unity7 rssreader-app,snaptest-app,ubuntu-calculator-app :x11 -
name: foo apps: bar: command: bin/bar plugs: [ home, unity7 ]
$ sudo snap install <package.snap> --devmode
liuxg@liuxg:~$ snap --help Usage: snap [OPTIONS] <command> The snap tool interacts with the snapd daemon to control the snappy software platform. Application Options: --version print the version and exit Help Options: -h, --help Show this help message Available commands: abort Abort a pending change ack Adds an assertion to the system change List a change's tasks changes List system changes connect Connects a plug to a slot create-user Creates a local system user disconnect Disconnects a plug from a slot find Finds packages to install help Help install Install a snap to the system interfaces Lists interfaces in the system known Shows known assertions of the provided type list List installed snaps login Authenticates on snapd and the store logout Log out of the store refresh Refresh a snap in the system remove Remove a snap from the system run Run the given snap command try Try an unpacked snap in the system
liuxg@liuxg:~$ snap install -h Usage: snap [OPTIONS] install [install-OPTIONS] <snap> The install command installs the named snap in the system. Application Options: --version print the version and exit Help Options: -h, --help Show this help message [install command options] --channel= Use this channel instead of stable --edge Install from the edge channel --beta Install from the beta channel --candidate Install from the candidate channel --stable Install from the stable channel --devmode Install the snap with non-enforcing security
$ git clone https://github.com/ubuntu/snappy-playpen.git $ cd snappy-playpen
atom/ idea/ openttd/ tinyproxy/ cloudfoundry-cli/ imagemagick-edge/ plank/ tyrant-unleashed-optimizer/ consul/ imagemagick-stable/ qcomicbook/ ubuntu-clock-app/ dcos-cli/ keepassx/ qdriverstation/ ubuntukylin-icon-theme/ deis-workflow-cli/ kpcli/ ristretto/ vault/ dosbox/ leafpad/ scummvm/ vlc/ ffmpeg/ minetest/ shotwell/ wallpaperdownloader/ galculator/ moon-buggy/ smplayer/ youtube-dl/ gitter-im/ mpv/ snap-template/ heroku/ openjdk-demo/ snaptest/
$ snapcraft当项目被成功编译完后,我们可以直接在项目的根目录下找到一个扩展名为.snap的文件.这就是我们所需要的snap安装文件.我们可以参照我们上面讲述的方法来安装这个文件.
name: snaptest-app version: 1 summary: This is a summary description: This is the description confinement: devmode apps: test: command: desktop-launch $SNAP/lib/x86_64-linux-gnu/bin/snaptest plugs: [home,unity7,opengl] parts: application: source: ./src plugin: qmake qt-version: qt5 build-packages: - cmake - gettext - intltool - ubuntu-touch-sounds - suru-icon-theme - qml-module-qttest - qml-module-qtsysteminfo - qml-module-qt-labs-settings - qtdeclarative5-u1db1.0 - qtdeclarative5-qtmultimedia-plugin - qtdeclarative5-qtpositioning-plugin - qtdeclarative5-ubuntu-content1 - qt5-default - qtbase5-dev - qtdeclarative5-dev - qtdeclarative5-dev-tools - qtdeclarative5-folderlistmodel-plugin - qtdeclarative5-ubuntu-ui-toolkit-plugin - xvfb stage-packages: - ubuntu-sdk-libs - qtubuntu-desktop - qml-module-qtsysteminfo snap: - -usr/share/doc - -usr/include after: [desktop/qt5]
$ snaptest-app.test
标签:
原文地址:http://blog.csdn.net/ubuntutouch/article/details/51886345