frizzby
frizzby

Reputation: 419

How to make rpm spec that moves files that were previously marked as %config?

The problem I'm trying to solve is following:

In older releases of my package there were config files placed at /srv/product/ dir.

%config /srv/product/conf1
%config /srv/product/conf2

But in next upcoming release I removed these conf files from the package. In case if user upgrades the package with new version (where configs are no longer included into rpm) I want configs from previous release to be moved to different dir (which is part of pkg) and keep them there, but still to have them as not part of package.

I tried to move files with %pre and %post scriplets but it didn't work. The old configs are either moved and then overwritten by their parent dir or are already been removed at /srv/product.

Is it possible to implement that within rpm spec file?

Upvotes: 1

Views: 527

Answers (1)

msuchy
msuchy

Reputation: 5417

You need to save the file in %pre and restore it in %post section. How you can save the file or in general any state see https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Saving_state_between_scriptlets

Upvotes: 3

Related Questions