The files macro

RPM needs to know what files to archive into a binary RPM. The %files macro contains a list of files relative to RPM_BUILD_ROOT. Listing 12-9 shows an example.

Listing 12-9: The %files Macro for logcheck


%defattr(644,root,root,755) %doc CHANGES CREDITS README %attr(700,root,root)

systems/linux/README* %dir /etc/logcheck %attr(600,root,root) %config /etc/logcheck/* %attr(700,root,root) %config /etc/cron.hourly/logcheck /usr/sbin/ /usr/sbin/logtail

%attr(755,root,root) %attr(755,root,root)

The entries you want to note in this file are as follows:

♦ The %defattr macro sets the default file permissions for all files installed, unless explicitly stated for each file entry.

♦ One important files macro entry is the %doc macro. It is used to specify that the files listed are documentation. In SUSE, all RPM documentation is stored in

/usr/share/doc/packages/rpmname. Any files set as %doc type will be installed into /usr/share/doc/packages/logcheck.

♦ The %attr macro, like %defattr, sets the file permissions of the file specified. In the case of the logcheck configuration files, you have said that only root is allowed to access the files.

♦ The %config entry specifies that the file specified is a configuration file. When an RPM file is upgraded, any configuration files belonging to the RPM are "kept back" so that any changes you may have made are not lost.

Was this article helpful?

0 0

Post a comment