Systemd unit file implementation questions (ypbind)

Honza Horak hhorak at redhat.com
Wed Apr 13 17:55:26 UTC 2011


Hi,

I'm working on systemd unit file for ypbind and found some problems, 
that I'm not sure about:

1) if I use systemctl enable/disable instead of chkconfig in %post and 
%preun sections in spec file, rpmlint prints errors:
postin-without-chkconfig /etc/rc.d/init.d/ypbind
preun-without-chkconfig /etc/rc.d/init.d/ypbind
Is this just rpmlint problem or should I change %post and %preun 
sections somehow?

%post and %preun sections in spec file:

%post
/bin/systemctl enable %{name}.service || :

%preun
if [ $1 -eq 0 ] ; then
     /bin/systemctl stop %{name}.service >/dev/null 2>&1 || :
     /bin/systemctl disable %{name}.service >/dev/null 2>&1 || :
fi


2) there is some code before and after starting the daemon in former 
SysV init script, which should be executed even when using systemd unit 
file. I created two scripts, placed them to /usr/lib/ypbind/ and add 
them to "ExecStartPre:" in ypbind.service file. Is this correct solution 
or there is a better one to execute more complicated scripts 
before/after daemon script itself?

Regards,

Honza


More information about the devel mailing list