Directives For the %files list

This section lists the various directives used in the %files lists.

File-related Directives

This section lists those directives that are related to files.

The %doc Directive

The %doc directive flags the filename(s) that follow as being documentation.

%doc README
          

See also: the Section called The %doc Directive in Chapter 13.

The %config Directive

The %config directive is used to flag the specified file as being a configuration file.

%config /etc/fstab
          

See also: the Section called The %config Directive in Chapter 13.

The %attr Directive

The %attr directive is used to permit RPM to directly control a file's permissions and ownership. It is normally used when non-root users build packages. The %attr directive has the following format:

%attr(<mode>, <user>, <group>) file
          

The user and group identifiers must be non-numeric. Attributes that do not need to be set by %attr may be replaced with a dash:

%attr(755, root, -) foo.bar
          

See also: the Section called The %attr Directive in Chapter 13.

The %attr Directive

The %defattr sets default %attr for RPM.

The %defattr directive has the following format:

%attr(<file mode>, <user>, <group>, <dir mode>)
          

The user and group identifiers must be non-numeric. Attributes that do not need to be set by %defattr may be replaced with a dash. Directory mode may be ommited:

%defattr(644, root, root, -)
          

See also: the Section called The %defattr Directive in Chapter 13.

The %verify Directive

The %verify directive is used to control which of nine different file attributes are to be verified by RPM. The attributes are:

  1. owner — The file's owner.

  2. group — The file's group.

  3. mode — The file's mode.

  4. md5 — The file's MD5 checksum.

  5. size — The file's size.

  6. maj — The file's major number.

  7. min — The file's minor number.

  8. symlink — The file's symbolic link string.

  9. mtime — The file's modification time.

If the keyword not precedes the list, every attribute except those listed will be verified.

%verify(mode md5 size maj min symlink mtime) /dev/ttyS0
          

See also: the Section called The %verify Directive in Chapter 13.

Directory-related Directives

The %docdir Directive

The %docdir directive is used to add the specified directory to RPM's internal list of directories containing documentation. When a directory is added to this list, every file packaged in this directory (and any subdirectories) will automatically be marked as documentation.

See also: the Section called The %docdir Directive in Chapter 13.

The %dir Directive

The %dir directive is used to direct RPM to package only the directory itself, regardless of what files may reside in the directory at the time the package is created.

%dir /usr/blather
          

See also: the Section called The %dir Directive in Chapter 13.