如果我们打开我们的Ubuntu Core安装的Core应用,在这个Core应用的安装目录中,我们会发现一个应用叫做xdg-open:
/snap/core/current/usr/local/bin$ ls apt apt-cache apt-get no-apt xdg-open
关于xdg-open的更多描述可以在地址: https://linux.die.net/man/1/xdg-open找到。我们可以利用它来打开我们的所需要的文件或url。现在我们来利用它来启动一个应用,比如一个网站。为此,我们的snapcraft.yaml文件如下:
snapcraft.yaml
name: google version: "1" summary: this is a test program for launching a website using browser description: | Launch google website using xdg-open grade: stable confinement: strict architectures: [amd64] apps: google: command: run.sh "http://www.google.com" plugs: [network,network-bind,x11,home,unity7,gsettings] parts: files: plugin: dump source: scripts organize: run.sh: bin/run.sh integration: plugin: nil after: [desktop-gtk2]
scripts
#!/bin/sh PATH="$PATH:/usr/local/bin" xdg-open $1
我在Ubuntu Desktop上安装一个debian包:
$ sudo apt install snapd-xdg-open
$ google
我们可以看出google网站被成功启动。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。