Reputation: 302
i am trying to install multiple RPM from one RPM install.i have make the spec file into that in %post section i install the another rpm using command.
%post
rm -f /var/lib/rpm/__db.0*
rpm --rebuilddb
rpm -ivh xyz.rpm
But when the main RPM is install it will get the lock an not release for the another rpm install.so it gives the following warning and stop the installation process.and wait infinite. so any solution for that.
Upvotes: 2
Views: 2264
Reputation: 481
S.O won't let me append a comment to the previous answers, but I wanted to stress one thing:
There is NO WAY your plan of doing an rpm-i during %post is going to work. Architecturally it's not going to happen for the exact reason you mention: rpm locks the RPMdb, and it does this to prevent race conditions and some corruption. So you will need to find another solution.
There is one solution, and by far, the Requires: bit is the one. I know you want to install your xyz rpm AFTER the current one, but there's no 'install after' because there's no post-requires for the same reason we use 'go to' and not 'come from'.
So, use the Requires: tag. If your ordering isn't perfect with just your abc.rpm depending on xyz.rpm, or xyz.rpm depending on abc.rpm, build a third, 'virtual' RPM which delivers no payload but requires them both: at the very least, this last solution will ensure both packages are installed.
While everyone else recommended the Requires: tag, and talked about alternatives to rpm-i in %post, I didn't find anyone addressing the potential to use rpm in %post itself directly; and I wanted to make sure the OP knew there was no potential in the near future for the proposed plan to work.
Upvotes: 1
Reputation: 1440
If I understand your question correctly you should be using the Requires tag.
Upvotes: 4