Skip to content

Enhance mkdwarfs to support specifying a list of files to include (similar to cpio) #6

Closed
@cipriancraciun

Description

@cipriancraciun

A very nice feature to cpio (actually the only operation mode) or tar (via the --files-from) is the option of specifying a list of files to include (instead of recursing through the root folder).

Such a feature would allow one to easily exclude certain files from the source, without having to resort to rsync for example to build a temporary tree.

This could work in conjunction with -i as such: any file within the list are treated as relative to the -i folder, regardless if they start with /, ./ or plain path. Also warn if one tries to traverse outside the -i folder. For example, given that -i source is used:

  • whatever is actually source/whatever;
  • ./whatever is the same as above;
  • /whatever is the same as above;
  • ../whatever would issue an error as it tries to escape the source;
  • a/b/../../c is actually source/c, although it could issue a warning;
  • /some-folder (given it is a folder) would not be recursed, but only itself is created within the resulting image; (it is assumed that one would add other files afterwards);

Also it would be nice to have an option to zero-terminate files list instead of newline.


The above could be quite simple to implement, however an even more useful option would be something like this:

  • in the Linux kernel there is a small tool gen_init_cpio.c (https://github.com/torvalds/linux/blob/master/usr/gen_init_cpio.c#L452) which takes a file describing how an cpio archive (to be used for the initramfs) should be created (see the source code at the hinted line for the file syntax); thus in addition to the previous feature of file-lists, such a "file-system" descriptor would allow one to create (without root credentials on his machine) a file-system with any layout;
  • as an extension to the above, perhaps JSON would be a better choice; :)

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions