开发者

Problem with multiple listings of the same file in RPM spec

开发者 https://www.devze.com 2023-03-25 21:32 出处:网络
I have some problems with an rpm spec file that is listing the same file multiple times. For this spec we do some normal compilation and then we have script that copies everything to the buildroot. Wi

I have some problems with an rpm spec file that is listing the same file multiple times. For this spec we do some normal compilation and then we have script that copies everything to the buildroot. Within this buildroot we have a lot of generic scripts that need to be installed on the final system, so we just list this directory.

However the problem is, that one of the scripts might be changed and configuration options might be changed within the script. So we list this script with different attributes as %config. However this means the script is defined multiple times with conflicting attributes, so rpmbuild complains and does not 开发者_运维百科include the script at all in the installation package.

Is there a good way to handle this problem and to tell rpmbuild to only use the second definition, or do we have to seperate the script into two parts, one containing the configuration and one containing the actual logic?


Instead of specifying the directory, you can create a file list and then prune duplicate files from that.

So where you have something like

%files
%dir foo
%config foo/scriptname

You modify those parts to

find $RPM_BUILD_ROOT -type f | sed -e "s|^$RPM_BUILD_ROOT||" > filelist
sed -i "\|^foo/scriptname$|d" filelist

%files -f filelist
%config foo/scriptname

You can also use %{buildroot} in place of $RPM_BUILD_ROOT.

0

精彩评论

暂无评论...
验证码 换一张
取 消