Product SiteDocumentation Site

Install and uninstall scripts

RPM packages can run scripts prior to installation with %pre, and after installation with %post. You can also run scripts prior to an uninstall with %preun and after an uninstall with %postun. For example:
%post
/sbin/chkconfig --add ypbind
%preun
if [ "$1" = 0 ] ; then
/sbin/service ypbind stop > /dev/null 2>&1
/sbin/chkconfig --del ypbind
fi
exit 0
%postun
if [ "$1" -ge 1 ]; then
/sbin/service ypbind condrestart > /dev/null 2>&1
fi
exit 0