Yum – install package forcing replacing files

rpmyum

I want to install one package with yum and not using rpm but with the same behavior like --replacefiles in rpm. I have one package that have file conflicts with other and I need to install forcing with yum. This package is mine, so I can modify spec file.

Best Answer

You can use trigger scriptlets for this.

For illustration, let's say that the file /etc/contested is owned by a rpm named generally, and you have another package (specifically) which wants to force-overwrite the same file.

In specifically.spec, you install the new version of the file to %{_datadir}/%{name}/etc.contested, and use this trigger scriptlet to install it to /etc:

%triggerin -- generally install -m 0644 %{_datadir}/%{name}/etc.contested %{_sysconfdir}/contested

The scriptlet will be run every time that generally is installed or updated, as well as every time specifically is installed or updated.

RPM will still notice that the file isn't as it's expected to be, but it won't stop you from installing or uninstalling.

Related Topic