Hello, On Feb 13 12:51 Frederic Crozat wrote (excerpt):
Le jeudi 13 février 2014 à 11:43 +0100, Johannes Meixner a écrit :
How exactly should the RPM spec file scriptles be in package foobar version 1 versus foobar version 2 when foobar version 1 provides foo.service and bar.service but foobar version 2 still provides only foo.service but does no longer provide bar.service?
This is not handled by the macros (and AFAIK, it wasn't the case with the initscripts macros either). You'll have to write this manually using RPM triggers, to properly stop the services and disable them.
Is there a recommended and prehaps already somewhere documented way how one should do that? I would do in a foobar version 2 RPM scriptlet something like ------------------------------------------------------------------------ for f in /etc/systemd/system/*/bar.service do if test -L $f -a ! -e $f then systemctl stop bar.service systemctl disable bar.service fi done ------------------------------------------------------------------------ My reasoning for the "test -L $f -a ! -e $f" therein is: To be safe I like to stop and disable bar.service only when its systemd setup is broken and therefore I test if /etc/systemd/system/*/bar.service is a broken symbolic link. I hope that this test is reasonably sufficient to determine whether or not the bar.service systemd setup is broken. When foobar version 2 does no longer provide bar.service the admin may have installed his own bar.service unit file so that /etc/systemd/system/*/bar.service is not a broken symbolic link and in this case I do not want to stop or disable bar.service. Is my reasoning correct or should I easily just simply run ------------------------------------------------------------------------ systemctl stop bar.service systemctl disable bar.service ------------------------------------------------------------------------ in an unconditioned way? Kind Regards Johannes Meixner -- SUSE LINUX Products GmbH -- Maxfeldstrasse 5 -- 90409 Nuernberg -- Germany HRB 16746 (AG Nuernberg) GF: Jeff Hawn, Jennifer Guild, Felix Imendoerffer