xref: /freebsd/tools/pkgbase/README.md (revision 3cbb4cc200f8a0ad7ed08233425ea54524a21f1c)
1`metalog.lua` is a script that reads METALOG file created by pkgbase
2(make packages) and generates reports about the installed system
3and issues
4
5the script accepts an mtree file in a format that's returned by
6`mtree -c | mtree -C`
7
8synopsis:
9```
10metalog_reader.lua [-h] [-a | -c | -p [-count] [-size] [-f...]] [-W...] [-v] metalog-path
11```
12
13options:
14
15* `-a` prints all scan results. this is the default option if no option is
16  provided.
17* `-c` lints the file and gives warnings/errors, including duplication and
18  conflicting metadata
19  *  `-Wcheck-notagdir` entries with dir type and no tags will be also included
20     the first time they appear (1)
21* `-p` list all package names found in the file as exactly specified by
22  `tags=package=...`
23  * `-count` display the number of files of the package
24  * `-size` display the size of the package
25  * `-fsetgid` only include packages with setgid files
26  * `-fsetuid` only include packages with setuid files
27  * `-fsetid` only include packages with setgid or setuid files
28* `-v` verbose mode
29* `-h` help page
30
31some examples:
32
33* `metalog_reader.lua -a METALOG`
34  prints all scan results described below. this is the default option
35* `metalog_reader.lua -c METALOG`
36  only prints errors and warnings found in the file
37* `metalog_reader.lua -c -Wcheck-notagdir METALOG`
38  prints errors and warnings found in the file, including directories with no
39  tags
40* `metalog_reader.lua -p METALOG`
41  only prints all the package names found in the file
42* `metalog_reader.lua -p -count -size METALOG`
43  prints all the package names, followed by number of files, followed by total
44  size
45* `metalog_reader.lua -p -size -fsetid METALOG`
46  prints packages that has either setuid/setgid files, followed by the total
47  size
48* `metalog_reader.lua -p -fsetuid -fsetgid METALOG`
49  prints packages that has both setuid and setgid files (if more than one
50  filters are specified, they are composed using logic and)
51* `metalog_reader.lua -p -count -size -fsetuid METALOG`
52  prints packages that has setuid files, followed by number of files and total
53  size
54
55(1) if we have two entries
56```
57./bin type=dir uname=root gname=wheel mode=0755
58./bin type=dir uname=root gname=wheel mode=0755 tags=...
59```
60by default, this is not warned. if the option is enabled, this will be warned
61as the second line sufficiently covers the first line.
62