Mailinglist Archive: opensuse-packaging (220 mails)

< Previous Next >
Re: [opensuse-packaging] Packaging policy for systemd .unit file - Proposal
Le lundi 20 juin 2011 à 15:56 +0200, Frederic Crozat a écrit :
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.

Here is a new version of the proposal, based on our feedback :
(the various macros could be modified by distro if they also want to
support sysvinit service with the same macro, but it is outside the
scope of this initial proposal)

%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

(this macro could refer to different package, if people don't agree on
systemd-units as packagename)
%define systemd_requires()
# This is for /bin/systemctl
Requires(post): systemd-units \
Requires(preun): systemd-units \
Requires(postun): systemd-units \

%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 :

%post
%service_add demo.service
# Alternative: %service_add_enabled demo.service

%preun
%service_del_preun demo.service

%postun
%service_del_postun demo.service

when migrating a package from sysvinit to systemd :
%triggerun -- package_name < version_where_switch_occured
%service_migration_to_systemd [ -l run_level ] service_name

-l <run_level> is optional
--
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