Reputation: 157
I have created an rpm package and while installing it I want to replace all the existing directory and its contents with rpm package data
Let's say that I have a directory called config/ which has some config files (a.config, b.config, etc.), now a.config
is deprecated and I don't want it anymore. So I created a new rpm package with all the files except a.config
, but when I install the package it updates b.config
and every other file in the directory but it doesn't delete or remove a.config
.
I am using following command to install rpm package
rpm -Uvh --force package.rpm
I want to keep only those files and directory that are included in the package and delete other files and folders
Upvotes: 1
Views: 1217
Reputation: 157
If your first rpm
package correctly included a.config
in the %files
section, and it remained untouched, and was not listed in your second version of the package %files
section, then it should be removed automatically during the upgrade process. Your b.config
would be the only file that remains, added during the installation of the second package.
The only way a.config would remain, is if it was never listed with %files.
Upvotes: 1
Reputation: 157
To answer my own question,
whatever step you want to execute before rpm package installation starts, you need to define in %pre
script in rpm spec file.
So I wrote
%pre
rm -f a.config
in my spec file and it removed the config file before rpm package installation started
Upvotes: 0