Skip to content
Advertisement

Packaging RPM, avoid creating .rpmnew file

I’m packaging some of my own software, as part of the installation I need to drop some config files in a directory that’s used by a 3. party.

To avoid overwriting configuration that have been locally changed, that file is marked as a config file like so in the RPM .spec file:

%config(norelace) /opt/lmd/conf/srv1.conf

The issue is that upgrading an rpm will now produce the file

 /opt/lmd/conf/srv1.conf.rpmnew

if /opt/lmd/conf/srv1.conf have been altered locally. And the 3.d party software reads everything in /opt/lmd/conf/* .

Can I somehow mark a config file in the RPM .spec file to not produce such an .rpmnew file ?

Advertisement

Answer

Not that I’m aware of. This (and the human-made equivalents .bak, .off, .tmp etc.) is why most tools glob *.conf or similar when they read configuration files.

If you can’t modify the third-party tool to fix that problem then you really can’t do much about this short of not installing to that directory directly and making the user do the copying.

(You could package the old file too or sums of the old config file and check those against the current file in %post, etc. but that’s ugly, manual and prone to possible failures.)

You might be able to manually remove/move the .rpmnew files in your %post (or %posttrans) scriptlet but I don’t know if that’s actually possible (timing-wise).

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement