您的位置:首页 > 其它

如何利用make plugin来安装我们的debian文件

2016-12-21 16:45 656 查看
在我们先前的文章"Snap Chrome浏览器及展示如何在snap中打入debian包",我们介绍了如何利用dump plugin来安装我们的debian package.那个方法虽好,但是刚才有个开发者问我,如果他有很多的这种debian包的话,那么那样的写法将会使得我们的snapcraft.yaml非常难看,因为我们需要写很多个part来完成这样的工作.在今天的这篇文章中,我们来重点介绍如何使用make
plugin来完成我们的debian包的安装.当然我们可以如法炮制,利用make plugin可以做我们很多想要做的事情.在这里我们就抛砖引玉.

就想我在chrome那篇文章中介绍的那样,我们可以重新改写我们的snapcraft.yaml文件.

snapcraft.yaml

name: mychrome # you probably want to 'snapcraft register <name>'
version: '0.3' # just for humans, typically '1.2+git' or '1.3.2'
summary: Chrome for snap # 79 char long summary
description: |
This is chrome app in snap format

grade: stable # must be 'stable' to release into candidate/stable channels
confinement: strict # use 'strict' once you have the right plugs and slots

apps:
mychrome:
command: desktop-launch $SNAP/opt/google/chrome/chrome
plugs: [unity7,home,x11,opengl,network,network-bind,browser-support,process-control,fuse-support,camera,gsettings,pulseaudio]

parts:
chrome:
plugin: make
source: ./
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
- fcitx-frontend-gtk2

after: [desktop-gtk2]


首先在这里,我们可以看到我已经把dump plugin换成make plugin了.当然有了make plugin,我们最重要的一点是需要有一个Makefile在我们source所指定的目录:

Makefile

all:
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb dpkg -x google-chrome-stable_current_amd64.deb .

install:
cp -a usr $(DESTDIR)
cp -a opt $(DESTDIR)


在这里,我们通过wget命令来下载我们的debian包,然后,我们通过dpkg -x命令来展开我们的debian包.在安装的时候,我们把我们所需要的usr及opt两个目录考入到我们所需要安装的目录之中.当然,如果我们有更多的debian包的话,我们只需要在上面的Makefile之中再加入它们即可.这样就好像一个批处理文件.否则如果我们在snapcraft.yaml中利用dump plugin的话,我们会对每一个debian文件都要写一个相应的part,那么就显得非常凌乱.

重新打包我们的应用,我们会发现它和原来的包是一样的.我们把我们的debian包里的内容成功打入到我们的snap包中.

liuxg@liuxg:~/snappy/desktop/chrome_makefile/prime$ tree -L 2
.
├── bin
│   └── desktop-launch
├── command-mychrome.wrapper
├── etc
│   ├── apparmor.d
│   ├── drirc
│   ├── fonts
│   ├── gss
│   ├── gtk-2.0
│   ├── gtk-3.0
│   ├── pki
│   ├── presage.xml
│   ├── ucf.conf
│   └── X11
├── flavor-select
├── lib
│   └── x86_64-linux-gnu
├── meta
│   ├── gui
│   └── snap.yaml
├── opt
│   └── google
├── usr
│   ├── bin
│   ├── lib
│   ├── sbin
│   └── share
└── var
└── lib
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐