linux - 如何在 RPM SPEC 文件中设置可选配置文件?

标签 linux rpm rpm-spec

有没有办法可以将配置文件标记为可选,以便在调用验证(rpm -v)时,它将忽略丢失的配置文件?


我有一个 RPM 包,其中包含我的应用程序的默认配置文件。我的应用程序不需要配置文件,但我想将其包含在内以方便配置。如果文件被删除,应用程序将按预期工作(具有一些内部默认值)。我面临的问题是,如果我删除配置文件,然后对安装的 RPM 运行验证,RPM 会表明该软件包信誉不佳:

rpm -V test-rpm

(输出)

missing c /etc/test/test.conf

最小化 SPEC 定义:

Version:    0.0.1
Name:       test-rpm

...

%install
install -m 644 $resource_directory/test.conf %{buildroot}/etc/test/test.conf

 ...

%files
%defattr(-,root,root)
%config(noreplace) /etc/test/test.conf

 ...

是否有一些我尚未找到的选项,或者我是否误解了有关 RPM 的内容?

最佳答案

这就是 %config(missingok)是因为我相信。

The %config(missingok) indicates that the file need not exist on the installed machine. The %config(missingok) is frequently used for files like /etc/rc.d/rc2.d/S55named where the (non-)existence of the symlink is part of the configuration in %post, and the file may need to be removed when this package is removed. This file is not required to exist at either install or uninstall time.

关于linux - 如何在 RPM SPEC 文件中设置可选配置文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28770969/

相关文章:

linux - 如何grep值小于或等于值的行

linux - WGET 后运行 bash 脚本会忽略读取用户输入

python - 如何通过 RPM 分发 Python/Django App

php - 如何通过在浏览器中运行页面来删除文件和文件夹?

python - 在 debian 上安装 scrapy

rpm - yum 降级会发生什么?

linux - noarch rpm 和 rpm 之间的区别

rpm - 构建 RPM 以安装文件

linux - 在 RPM 规范文件中使用 Jenkins BUILD NUMBER

linux - 如何防止 RPM 被视为多库包