Mailinglist Archive: opensuse-packaging (220 mails)

< Previous Next >
Re: [opensuse-packaging] Packaging policy for systemd .unit file - Proposal
Le lundi 20 juin 2011 à 16:13 +0200, Andreas Jaeger a écrit :

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

I'm ok with this part, but we must split systemd on openSUSE to be like
Fedora one (I don't have objection).

%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

Hmm, this part might be a too distro specific to be macro-ified :
- it depends on runlevel (which might be different in distro or not
relevant at all)
- it depends on tool to handle sysvinit (we could call chkconfig but
even this might not be on all distro or in the same path)

another possibility could be to add a optional macro (this one is
untested ;)

%service_migrate_to_systemd(l)
{-l:LEVEL="-l $1 ; shift }
if /sbin/chkconfig $LEVEL %{1} ; then
/bin/systemctl --no-reload enable %{1}.service >/dev/null 2>&1 || :
fi

usage :
%triggerun -- ypbind < 3:1.32-9
%service_migration_to_systemd -l 3 ypbind

--
Frederic Crozat <fcrozat@xxxxxxxx>
SUSE

--
To unsubscribe, e-mail: opensuse-packaging+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-packaging+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups