西安高新网站制作,wordpress模版制作工具,企业官网html源码,wordpress背景板snap做包还在学习阶段#xff0c;官网文档可查看#xff1a;The content interface | Snapcraft documentation该例子由publiser和consumer两部分组成#xff0c;一个提供一个只读的数据区#xff0c;一个来进行读取其中的信息#xff0c;这样就完成了content的交互。publ…snap做包还在学习阶段官网文档可查看The content interface | Snapcraft documentation该例子由publiser和consumer两部分组成一个提供一个只读的数据区一个来进行读取其中的信息这样就完成了content的交互。publisher:整体的结构如下snapcraft.yaml文件内容如下name: publisher
version: 1.0
summary: data publisher
description: |This demo is intended to show how to build your first snapThis code is part of the Snapcraft example tour athttps://developer.ubuntu.com/snapcraft-getting-startedgrade: stable
confinement: strict
base: core20parts:data:plugin: dumpsource: ./env/slots:content:interface: contentcontent: example-contentread:- $SNAP/publisher-data
example.txt则自己随意写一个内容进行测试即可。编译snapcraft consumer:整体结构如下snapcraft.yaml文件内容如下name: consumer
version: 1.0
summary: data comsumer
description: |This demo is intended to show how to build your first snapThis code is part of the Snapcraft example tour athttps://developer.ubuntu.com/snapcraft-getting-startedgrade: stable
confinement: strict
base: core20parts:data:plugin: dumpsource: ./consumer-data/apps:print-cli:command: print.shplugs:content:interface: contentcontent: example-contenttarget: $SNAP_DATA/publisher-data
print.sh:echo hello这里print.sh和consumer.txt并不是必要的这里可以方便测试而已。编译snapcraft 测试安装并添加interface的连接sudo snap install publisher_1.0_amd64.snap --dangerous
sudo snap install consumer_1.0_amd64.snap --dangerous
sudo snap connect consumer:content publisher:content这里使用的是手动连接使用 sudo snap connections publisher可以查看连接之后的状态。验证:consumer可以访问到数据了sudo snap run --shell consumer.print-cli 就进入了consumer的文件系统然后 ls /var/snap/consumer/x1/publisher-data/就应该看到example.txt文件已经乖乖在里面等着你去访问了。当然你也可以将这个命令直接写入print.sh然后使用命令行直接读取该数据。