Every rules file is preprocessed with M4, see $VAR/template/group/rules-master for example. M4 is documented in section 4.
Every file/directory/symlink/device in the source directory is searched top to bottom in the rules file associated with the source directory. The first matching entry is used and the rest are ignored.
--- [type] pattern@package ||| | | |- optional - match entire list of files in Debian package ||| | | ||| | =string - match constant string ||| | other - match perl regular expression. ||| | ||| |- optional - [dir] only match directories ||| - [symlink] only match symlinks ||| - [device] only match devices ||| - [file] only match normal files ||| |||-C allow converting this file using M4 filter || ||- c allow copying of this file || |-- d if matching file is a directory, then descend into it. (Note: if directory doesn't have c set, then either dir must be found in another source dir or destination must already exist).
If both a pattern and a package are specified, then the file must match both.
Also supported are (these are parsed *before* the rules above):
Table 4-1. Rules Commands
@rename =$src=$dst= | Use with extreme caution, renaming individual files is OK, using substitution is OK, however may cause problems. |
@ignore $src | Source file is not copied, even if it exists in a source directory with higher priority. |
Potential problems with rename:
Table 4-2. Pitfalls with rename
@rename =(.*)=/etc$1= | Should put all files from this source under the etc dir, but will complain if this dir doesn't exist, or doesn't exist in time. |
@rename =(.*)=$1.old= |
This is pure evil. DO NOT DO IT! For example,
consider:
/ ===> /.old /a ===> /a.old /a/b ===> /a/b.old /a/b/c ===> /a/b/c.oldThis is probably not intended, and will fail if the /a/b directory doesn't already exist. |
Do not use quotes in from expression, is the result is determined through "eval", and quotes will mess this up. There may be other things to watch out for.