在 snap 中包含隐藏文件

在 snap 中包含隐藏文件

我正在尝试使用“复制”插件从文件夹结构创建 snap 包。当我这样做时,文件夹结构中的隐藏文件不会被包含,但我需要它们。

是否有任何选项可以告诉复制插件包含隐藏文件?

答案1

这是可能的。snapcraft help copy了解有关该主题的更多信息:

- files:
  (object)
  A dictionary of key-value pairs. The key is the current location of the
  file relative to snapcraft.yaml (unless `source` is specified, in which
  case it's relative to the root of the source). The value is where to
  place the file in-snap, and is relative to the root of the snap. This
  works like `cp -r <key> <value>`. Note that globbing is supported for the
  key, allowing one to use *, ?, and character ranges expressed with [].

使用snapcraft init,我为此整理了一个非常快速的项目:

daniel@daydream:~/test$ touch bla .bla blubb .blubb
daniel@daydream:~/test$ find
.
./blubb
./.bla
./bla
./snapcraft.yaml
./.blubb
daniel@daydream:~/test$ 

snapcraft.yaml文件如下所示:

name: my-snap
version: 0
summary: This is my-snap's summary
description: This is my-snap's description
confinement: devmode

parts:
    my-part:
        plugin: copy
        files:
          "*": contents/
          ".*": contents/

运行之后snapcraft,我可以看到包中有以下文件:

daniel@daydream:~/test$ find prime/
prime/
prime/meta
prime/meta/snap.yaml
prime/contents
prime/contents/blubb
prime/contents/.bla
prime/contents/bla
prime/contents/.blubb
daniel@daydream:~/test$ 

相关内容