Snap chrome and show how to enter Debian packages in snap

Source: Internet
Author: User
Tags gtk

The Chrome browser is a very important application. It is even a tool that we do not have to work on at ordinary times. In today's tutorial, we'll show you how to package a Chrome browser as a snap app.


We know that whenever we install our Chrome browser on a computer, we can download our Chrome Deb installation package at the following address:

Https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb

Of course, this is for 64-bit machines. How do we install this Debian package in our Snapcraft? The answer is to use dump plugin. To this end, the contents of our Snapcraft.yaml are as follows: Snapcraft.yaml

Name:mychrome # probably want to ' Snapcraft register <name> ' version: ' 0.2 ' # Just for humans, typically ' 1.2+g
  It ' or ' 1.3.2 ' Summary:chrome for snap # (char) long Summary description: |  This is the Chrome app in snap format Grade:stable # must are ' stable ' to release into candidate/stable channels confinement: Strict # use ' strict ' once you has the right plugs and slots Apps:mychrome:command:desktop-launch $SNAP/opt/g Oogle/chrome/chrome plugs: [Unity7,home,x11,opengl,network,network-bind,browser-support,process-control, Fuse-support] Parts:chrome:plugin:dump Source:https://dl.google.com/linux/direct/google-chrome-stable_curre Nt_amd64.deb stage-packages:-OVERLAY-SCROLLBAR-GTK2-LIBATK-ADAPTOR-LIBGAIL-COMMON-LIBC  Anberra-gtk-module-libnss3-tools-libglu1-mesa # language Support-fonts-freefont-ttf- Ttf-freefont-ttf-wqy-microhei-fonts-wqy-microhei # Input METHOD-FCITX-FCITX-FRONTEND-GTK2 after: [DESKTOP-GTK2]
 

As can be seen above, we use dump plugin to install our google-chrome-stable_current_amd64.deb files. In order for our chrome to work correctly, we also have the other Debian packages it needs in our snap package.
    Stage-packages:
      -overlay-scrollbar-gtk2
      -libatk-adaptor
      -Libgail-common
      - Libcanberra-gtk-module
      -Libnss3-tools
      -Libglu1-mesa

      # language Support
      -Fonts-freefont-ttf
      - Ttf-freefont
      -Ttf-wqy-microhei
      -Fonts-wqy-microhei

      # Input Method
      -FCITX
      

These are Debian packages from Ubuntu archive that will eventually be penetrated into our snap package. Maybe someone asked: why can't we use the same method (Stage-packages) to pack our google-chrome-stable_current_amd64.deb. The reason for this is that it does not come from Ubuntu Archive, so stage-packages can not help us install it. Here, because we need the Chinese display in the application, so I also put the corresponding language font package into our application. For support in other languages, developers can add their own to the list of languages. In addition, in order to match the input of our input method, I also put the corresponding input method package into our final snap package.
In addition, since this application is a GTK application, all of us must use the desktop-launch provided by DESKTOP-GTK2 to launch our application. Since this remote part must be preceded by the chrome part, all we use after to adjust the sequencing in the build process.
It is worth noting here that we use two non-automatically connected Plug/slot interfaces (interfaces): Process-control and Fuse-support. In the future if the app is published to the stable channel, and we don't install it with the--devmode option, we can use the following command to install and need to do the corresponding manual connection:
$ sudo snap install mychrome
$ sudo snap connect mychrome:fuse-support ubuntu-core:fuse-support
$ sudo snap Connec T Mychrome:fuse-support Ubuntu-core:process-control

Since my Mychrom application is currently published to BetaChannel, and there are individual security issues that have not been fully addressed. We can use--devmode to install:
$ sudo snap install mychrome--beta--devmode

After installing our Chrome app, we can find the appropriate chrome icon in our dash. We can use this icon directly to launch our app:





The source of our project is: Https://github.com/liu-xiao-guo/mychrome
When debugging our application, we can enter the following command in a terminal:
$ sudo snap install snappy-debug
$ sudo snap connect snappy-debug:log-observe ubuntu-core:log-observe
$ sudo/sna P/bin/snappy-debug.security Scanlog Mychrome

In another terminal or in the dash, we can view our missing plugs or error message in the terminal above by launching our application Mychome directly. This approach can help us to debug our applications.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.