On Sat, 26 Jan 2013 20:17:14 +0100
Jan-Frode Myklebust <janfrode(a)tanso.net> wrote:
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.
Perhaps %triggerpostun?
http://docs.fedoraproject.org/en-US/Fedora_Draft_Documentation/0.1/html/R...
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 ?
You might take a look at the sendmail package, where the scriptlets are
done manually because the systemd version uses two "services" whilst
the sysv version had just the one, so some conversion was needed.
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 ?
systemctl try-restart $name
See:
http://fedoraproject.org/wiki/SysVinit_to_Systemd_Cheatsheet
Paul.