Hi,<div><br></div><div>This might be a little long-winded, but I am tearing my hair out over this problem. Here's the situation: we run our services under tomcat, and we have detailed configurations for each environment. At one time, before I got myself involved, all configs were managed "by hand", being checked-out from source control and placed in the required directory. There is a single file, "gwy-tomcat6" which gets sourced during startup, and in some cases an additional file "gwy-tomcat6.env" may also exist.</div>

<div><br></div><div>Based on some work I had done in another establishment, I realized we could manage these configs within the rpm, so I added some logic to determine which environment was being installed, and to make sure the correct configs were in place. Here is the strategy:</div>

<div><br></div><div>source control contains:  gwy-tomcat6.dev, <a href="http://gwy-tomcat6.qa">gwy-tomcat6.qa</a>, gwy-tomcat6.stg, gwy-tomcat6.perf, gwy-tomcat6.prod</div><div><br></div><div>these are put in place in the rpm %install section:</div>

<div><div>install -m 0644  server/sysconfig/gwy-tomcat6.prod         %{buildroot}%{_sysconfdir}/sysconfig/</div><div>install -m 0644  server/sysconfig/gwy-tomcat6.dev          %{buildroot}%{_sysconfdir}/sysconfig/</div><div>

install -m 0644  server/sysconfig/gwy-tomcat6.perf         %{buildroot}%{_sysconfdir}/sysconfig/</div><div>install -m 0644  server/sysconfig/<a href="http://gwy-tomcat6.qa">gwy-tomcat6.qa</a>           %{buildroot}%{_sysconfdir}/sysconfig/</div>

<div>install -m 0644  server/sysconfig/gwy-tomcat6.stg          %{buildroot}%{_sysconfdir}/sysconfig/</div></div><div><br></div><div>In the %post section, logic determines the environment, and does this (for example):</div>

<div><div>      cd /etc/sysconfig</div><div>      rm -f gwy-tomcat6.prod  gwy-tomcat6.perf</div><div>      rm -f gwy-tomcat6.stg</div><div>      rm -f <a href="http://gwy-tomcat6.qa">gwy-tomcat6.qa</a></div><div>      mv gwy-tomcat6.dev  gwy-tomcat6</div>

</div><div><br></div><div>All should then be well when the application starts up. But here's the kicker: during %postun, rpm does a removal of what it believes are artifacts from the previous version, and the carefully managed configuration file disappears!</div>

<div><br></div><div>I've tried numerous tricks like setting %config attributes:</div><div><div>%config %attr(644,root,root) %{_sysconfdir}/sysconfig/gwy-tomcat6</div></div><div><br></div><div>But then I just end up with a gwy-tomcat6.rpmnew which the application ignores. </div>

<div><br></div><div>Is there something I could do to solve this dilemma? </div><div><br></div><div>Regards,</div><div>Mark</div>