On Tue, Aug 13, 2019 at 10:37 PM Zbigniew Jędrzejewski-Szmek
<zbys...@in.waw.pl> wrote:
>
> On Tue, Aug 13, 2019 at 06:02:42PM +0800, Robin Lee wrote:
> > Hi,
> >
> > I packaged xe-guest-utilities with a systemd service for Fedora.
> >
> > But there is an upstream rpm package that include the same service as
> > a sysv one. And the
> > service is enabled with the 'Default-Start' info in the init script
> > after '/sbin/chkconfig --del xe-linux-distribution'.
> >
> > And when people update the package from upstream one to the Fedora
> > one. Since the service changed to a systemd one. The service is then
> > disabled by default without regard to the sysv service.
> >
> > That surprises end users. So the new package should make it compatible
> > in the scriptlets.
> > But which is the proper way?
>
> You can add a %trigger script. Something like this, completely untested:
> %triggerun xe-linux-distribution < …old…version+1…
> if test -e /etc/rc.d/rc3.d/Snn-…; then
>    # enable systemd service based on old status
>    systemctl enable xe-linux-distribution.service
> fi

Thanks for your tips!

I now use such version:

%triggerun -- %{name}
if /bin/ls /etc/rc3.d/S*%{service_name} >/dev/null 2>&1; then
    # Re-enable the service if it was enabled in sysv mode
    /usr/bin/systemctl enable %{service_name} >dev/null 2>&1||:
    /bin/rm /etc/rc3.d/S*%{service_name} >/dev/null 2>&1||:
    /usr/bin/systemctl try-restart %{service_name} >dev/null 2>&1||:
fi

>
> Please note that for new packages, the general guidelines apply
> (https://docs.fedoraproject.org/en-US/packaging-guidelines/DefaultServices/)
> and services should be managed through presets. But keeping enablement
> state on upgrade is outside of the guidelines and a nice thing to do.
>
> Zbyszek
> _______________________________________________
> devel mailing list -- devel@lists.fedoraproject.org
> To unsubscribe send an email to devel-le...@lists.fedoraproject.org
> Fedora Code of Conduct: 
> https://docs.fedoraproject.org/en-US/project/code-of-conduct/
> List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
> List Archives: 
> https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org

Reply via email to