有没有办法可以将配置文件标记为可选,以便在调用验证(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/