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?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
From the RPM Guide:
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.