gpt4 book ai didi

linux - rpm %config(noreplace) 用 %config 覆盖

转载 作者:太空狗 更新时间:2023-10-29 11:31:58 25 4
gpt4 key购买 nike

在我的 rpm 中,我有一个完整的目录,我想用 %config(noreplace) 标记它。在那个目录中有一个文件,我想在每次安装时用 rpm 的最新版本替换它,使用 %config 的语义。

使用此处的指南:http://www-uxsup.csx.cam.ac.uk/~jw35/docs/rpm_config.html ,我尝试了以下方法:

%files
%config(noreplace) /my/saved/dir/*
%config /my/saved/dir/file1

%files
%config /my/saved/dir/file1
%config(noreplace) /my/saved/dir/*

希望特定的命令会覆盖 glob,但它没有用。是否有任何类似 RPM 的命令可用于对嵌套在 %config(noreplace) 目录下的文件强制执行 %config 行为?

最佳答案

来自: http://ftp.rpm.org/max-rpm/s1-rpm-inside-files-list-directives.html

There is a restriction to the %config directive, and that restriction is that no more than one filename may follow the %config. This means that the following example is the only allowable way to specify config files:

%config /etc/foonly

Note that the full path to the file, as it is installed at build time, is required.

但是,您可以在 %install 部分动态制作该列表:

%install
echo '%dir /etc' >> list.txt
echo '%config(noreplace) /etc/foo' >> list.txt
# use for-loop or any other shell scripting technique

%files -f list.txt

关于linux - rpm %config(noreplace) 用 %config 覆盖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32610487/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com