[systemd-devel] RFC: creating a set of systemd RPM macros across distributions ?
Lennart Poettering
lennart at poettering.net
Mon Jun 27 05:24:02 PDT 2011
On Fri, 24.06.11 15:08, Frederic Crozat (fcrozat at suse.com) wrote:
Heya,
Sounds good! A few comments:
> %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
I'd strongly advise against this. Units might install more than one
service, and other units instead of services (example: sshd might just
enable a socket by default, but not a service). Hence we should not
appaned .service but leave it to the package to specifiy the full name
and we also need to make sure packagers can specify multiple unit files
at once.
> %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
Same applies to the other macros, too.
Otherwise looks pretty good.
Bill, what's your take on this? For some reason we solve very little
with macros like this on Fedora. Not sure why. Should I push for
including macros like this in rpm, or in the systemd packages?
Lennart
--
Lennart Poettering - Red Hat, Inc.
More information about the systemd-devel
mailing list