3.5. Common RPM directives in the %files section of spec


The following are the RPM directives that you can use in the %files section of a spec file.

Expand
표 3.1. %files section directives
MacroDefinition

%license

The %license macro identifies the file listed as a license. RPM installs and labels this file as the license, for example, %license LICENSE.

%doc

The %doc macro identifies a file listed as a documentation file. RPM installs and labels this file as the documentation file, for example, %doc README.

중요

Documentation can be excluded during package installation, for example, to conserve disk space on images. License files might look like documentation files, but they must always be installed with the software. Therefore, you must use the %license macro instead of %doc for license files.

The %doc macro is used for documentation about the packaged software, code examples, and various accompanying items. Note that if code examples are included, you must be careful when removing executable mode from the file.

%dir

The %dir macro ensures that the path is a directory owned by the RPM package. The RPM file manifest then accurately detects which directories to clean up during the uninstall operation.

Example usage:

%dir %{_libdir}/%{name}

%config(noreplace)

The %config(noreplace) macro ensures that the file is a configuration file. This file, therefore, must not be overwritten or replaced during a package installation or update if the file has been modified from the original installation checksum. If there is a change, the file will be created with .rpmnew appended at the end of the filename upon upgrade or installation. Therefore, the pre-existing or modified file on the target system remains unchanged.

Example usage:

%config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다. 최신 업데이트를 확인하세요.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

Theme

© 2026 Red Hat
맨 위로 이동