Reputation: 11
I have an RPM I build which unpacks a bunch of scripts I use across three different types of systems. I am trying to add a fourth system type which only needs a subset of the files packaged in the rpm. Is there a way to have the %install section only install some of the payload based on a simple check. something like
(sudo code)
if systemtype eq "type4"; then
install %file4
else
install %file
fi
All four systems run the same OS and a single RPM makes it much easier for me to give the RPM to other people for them to use, so I'd love to get this done with a single package.
I know I can do this in the %post section but the list of file I'll need to delete is very long, so I'd like to avoid this if I can.
Upvotes: 1
Views: 920
Reputation: 91017
You can have your spec file emit more than one RPM file at once. This is called "subpackaging".
If you adjust them so that they match the dependencies given on the various machines, you could end up with a certain number of packages which can be installed as they are fit.
Upvotes: 0
Reputation: 1440
Completing this task with a single RPM isn't a very good plan. As Marc said you can write a shell script like you would anywhere else, but based on your question this seems irrational. In your question you explained that this RPM goes onto one machine, so why not just package an RPM for that specific system? This reduces the RPM complexity in the event other users need to maintain the RPM, and it reduces the bloat on the RPM as well. In the short term a single RPM may be easier but in the long run multiple RPMs are going to be the better solution.
Upvotes: 1