|
|
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
In regard to: Re: confused about %config file directive, Greg_Swift@xxxxxxxxxx:
I want to create two RPMs. The first RPM install apache and I call it my-apache.rpm and a second my-apache-config.rpm. my-apache.rpm installs apache and my-apache-config.rpm adds some files like /usr/local/apache/conf/extra/my.conf but I also want it to overwrite my-apache.rpm's /usr/local/apache/conf/httpd.conf with a custom httpd.conf In my-apache.spec I used these lines: %files ... %config /apps/SD/apache/conf/httpd.conf but when I attempt to install the RPM via YUM I get an error Transaction Check Error: file /usr/local/apache/conf/httpd.conf from install of my-apache-config conflicts with file from package my-apache I tried not using the %config directive and had the same result. How can I specify in my spec file that it is OK to overwrite a file?There is no clean, right, or easy way to do this (at least not that I've found so please please please, someone correct me and prove me wrong).
There isn't a clean way to do this that I'm aware of either. I don't think "clean" would even apply in a situation like this. However, there are options. First, since the original person is also installing their own version of apache, the simple thing to do would be to - modify their version of apache to not include the stock configuration files (or to include them only as "%doc", so they're installed in your docs directory as a reference). - modify their version of apache so that it "Requires: my-apache-config", so that the my-apache can't be installed without also having appropriate config files installed. - package the custom apache config files in my-apache-config (having them marked as %config or %config(noreplace)). This avoids the "two packages want to install these files" problem. An alternative approach would be - don't actually include any config files (or any files at all, for that matter) in my-apache-config, keep them in the my-apache package. - use a %post install script to actually modify the apache config files, using something like perl or sed to edit the stock configuration files. This nicely avoids the conflicting files problem because you're not packaging any files, you're just providing a script that starts with some type of stock config file and converts it into your custom config. For extra credit, instead of using %post you could use a trigger. That has an even bigger advantage -- if your my-apache RPM is upgraded, you could set up your triggers so that your modification script is automatically run again, so your custom config gets re-applied without anyone needing to remember to uninstall/reinstall your my-apache-config RPM. One final alternative is to not manage your custom config settings via RPM at all, and instead use a configuration management system like puppet or (ugh) cfengine. If you have Red Hat Satellite, you might also have the ability to manage config files through that. Tim -- Tim Mooney mooney@xxxxxxxxxxxxxxxxxxxxxxxxx Enterprise Computing & Infrastructure 701-231-1076 (Voice) Room 242-J6, IACC Building 701-231-8541 (Fax) North Dakota State University, Fargo, ND 58105-5164 _______________________________________________ Rpm-list mailing list Rpm-list@xxxxxxxxxxxxx http://lists.rpm.org/mailman/listinfo/rpm-list