stop service ; remove some files ; start service in RPM %postun ?

Jan-Frode Myklebust janfrode at tanso.net
Sat Jan 26 19:17:14 UTC 2013


I have an rpm package where I need to stop the running service, remove
some files and start the service again depending on which package
version was already installed. I assume I need to do this in %postun,
where we normally do condrestart, but I don't know how to check the
version of the previously installed package. Could someone help me
here / does anybody have examples doing something similar ?

For sysv-init i guess it should be trivial to check "service $name
status" to see if it was running, and then stop/start it. But what's
the equivalent for systemd ? Currently I use
%systemd_postun_with_restart, but that needs to be split up so that I
can delete the files while the service is down..


  -jf


More information about the devel mailing list