1
votes

I have an rpm with a file marked as config file in the %files section:

%files
%config /path/to/file.conf

now suppose I edit this file on-disk. I wish to repair this and redo a clean install of the package; thus restoring the config file to its original state; using

zypper in -f my-package

after doing this; the config file is still in its edited version. If it was not a reinstall but an update (with an rpm containing a changed version!); then rpm would have moved my edited file to /path/to/file.conf.rpmsave and reinstalled the new one.

What are my options to circumvent this problem? Is this normal behavior? If I was using rpm; I suppose I could use rpm -if my-package.rpm --replacefiles; but that option does not exist for zypper.

PS I use this page for reference.

2

2 Answers

1
votes

Yes zypper would need to add --replacefiles in order to overwrite %config files. The harder issue (for zypper) is the scope of --replacefiles: the option applies to a transaction, not a single package in the transaction.

Easiest solution by far (imho) is to install the package manually using --replacefiles on the CLI.

-1
votes

It sounds like you are seeing the difference between %config and %config(noreplace). However, even if it doesn't replace, I think it should export it as file.conf.rpmnew.

You can always use rpm2cpio to extract the original file if you really need it.