On Monday, June 20, 2011 15:56:37 Frederic Crozat wrote:
Le vendredi 17 juin 2011 à 10:38 +0200, Frederic Crozat a écrit :
Le jeudi 16 juin 2011 à 13:48 +0200, Andreas Jaeger a écrit :
On Thursday, June 16, 2011 11:51:29 AM Pavol Rusnak wrote:
On 16/06/11 09:28, Vincent Untz wrote:
Le mercredi 15 juin 2011, à 18:57 +0200, Frederic Crozat a écrit :
However, I'm not sure we should directly add those direct call to systemctl in %post but instead, use some macros, similar to the one we have for sysvinit and / or update those macros to be systemd compliant : %stop_on_removal / %insserv_force_if_yast / %{fillup_only} / % restart_on_update / etc..
+1 for macros. I don't think it's worth trying to update the macros; adding new ones should work well enough -- especially as there's a new file to package anyway, so people will notice there's something to do.
Please, this is an opportunity to unify services packaging across all RPM distros. Please, don't screw up by introducing any new SUSE specific macros. We can talk with Fedora and Mageia at least to come up with one solution that is OK with everyone and has the highest chance of being adopted in upstream RPM.
I agree.
So, let's discuss on the systemd mailing list and propose something there - or what's the best way?
I sent a RFC on systemd-devel mailing list yesterday, we'll see how people react.
Reaction was positive.
Here is a proposal I plan to submit upstream if it is fine with people here. I've reused Michael Schröder proposal from FOSDEM 2006, adapted to systemd.
For openSUSE, we could modify slightly this proposal to call % fillup_and_insserv / %stop_on_removal / %restart_on_update when package hasn't migrated to systemd (I didn't add this part to systemd proposal, since it is distro specific) and would keep compat for current users of service_add / service_del_preun / service_del_post
(proposed at fosdem 2006) %service_add() if [ "$1" -eq 1 ] ; then # Initial installation /bin/systemctl daemon-reload >/dev/null 2>&1 || : fi
%service_add_enabled() if [ "$1" -eq 1 ] ; then # Initial installation /bin/systemctl enable %{1}.service >/dev/null 2>&1 || : fi
%service_del_preun() if [ "$1" -eq 0 ] ; then # Package removal, not upgrade /bin/systemctl --no-reload disable %{1}.service > /dev/null 2>&1 || : /bin/systemctl stop %{1}.service > /dev/null 2>&1 || : fi
%service_del_postun() /bin/systemctl daemon-reload >/dev/null 2>&1 || : if [ "$1" -ge 1 ] ; then # Package upgrade, not uninstall /bin/systemctl try-restart %{1}.service >/dev/null 2>&1 || : fi
Comments welcome
Let's add some examples. Please check whether the following is right for service demo.service: # XXX: systemd-units is the name on Fedora, should we use the same? # This is for /bin/systemctl Requires(post): systemd-units Requires(preun): systemd-units Requires(postun): systemd-units %post %service_add demo.service # Alternative: %service_add_enabled demo.service %preun %service_del_preun demo.service %postun %service_del_postun demo.service What I'm missing is the way to update so that the service is only enabled if it was enabled before. Fedora has something like the following in their files: # Package with native systemd unit file is installed for the first time %triggerun -- ypbind < 3:1.32-9 if /sbin/chkconfig --level 3 ypbind ; then /bin/systemctl --no-reload enable ypbind.service >/dev/null 2>&1 || : fi Andreas -- Andreas Jaeger, Program Manager openSUSE aj@{novell.com,suse.com,opensuse.org} Twitter/Identica: jaegerandi SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg) GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126 -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org