在snap中包括隐藏文件

我正在尝试使用"copy"插件从文件夹结构创建一个快照包。但是,当我这样做时,文件夹结构中的隐藏文件不会被包含在内,而我需要它们。
有没有任何选项可以告诉copy插件包括隐藏文件?
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$