I try to build rpm package. I follow here.

I want to run a script (bash or python) when run command as "rpm -Uvh mytest-1.0-1.el6.noarch.rpm" .

Could run a script when install a rpm package? How?


From the RPM Guide:

Defining installation scripts:

RPM supports a script run prior to installation, %pre, and a script run after installation, %post. The same concepts apply when a package is erased, or uninstalled. The %preun script is run just before the uninstall and the %postun script just after the uninstal

So, use the %pre section if you want to run the script right before the package is installed or the %post section if you want to run it after the package is installed.

See also Mandriva Howto, rpm.org

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.