snap 包可以依赖发行版提供的 .deb 包吗?

snap 包可以依赖发行版提供的 .deb 包吗?

是否可以这样构建 snap,当用户尝试安装它时,snap 还会安装另一个包?例如。wget谢谢。

答案1

对你的问题的简短回答是:不,snap 不能依赖于 .debs,因为当安装 snap 时,.deb 也会被安装。

但是,更详细的答案是,在构建 snap 时,你可以将你想要的任何 .deb 捆绑在其中。为了使用你的例子,下面是一个将 wget 捆绑在其中的 snap 的 snapcraft.yaml:

name: my-snap-name # you probably want to 'snapcraft register <name>'
base: core18 # the base snap is the execution environment for this snap
version: '0.1' # just for humans, typically '1.2+git' or '1.3.2'
summary: Single-line elevator pitch for your amazing snap # 79 char long summary
description: |
  This is my-snap's description. You have a paragraph or two to tell the
  most important story about your snap. Keep it under 100 words though,
  we live in tweetspace and your description wants to look good in the snap
  store.

grade: devel # must be 'stable' to release into candidate/stable channels
confinement: strict # 'strict' confinement means fully confined

parts: 
  my-part:
    plugin: nil
    # Include the wget .deb from the Ubuntu package archive
    stage-packages: [wget]

apps:
  # expose wget to end-users
  wget:
    command: usr/bin/wget
    plugs: [network, home, removable-media]

运行snapcraft它,你最终会得到一个带有wget应用程序的 snap。它不会像你要求的那样在安装时拉入 wget,但在构建时拉入也许可以实现你的最终目标。

答案2

Snap 软件包是独立的,不需要外部依赖即可运行。有关更多信息,请参阅此处Linux Commando:Snap

相关内容