Packaging naemon: Handling systemd-related stuff in %post

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Packaging naemon: Handling systemd-related stuff in %post

Johannes Kastl-2
Hi guys,

I stumbled upon the naemon package in server:monitoring, and gave
building naemon from the upstream spec a try:

home:ojkastl_buildservice:Naemon_upstream

I also tried to update the package in server:monitoring:
home:ojkastl_buildservice:branches:server:monitoring

I got both of them to build, but only by commenting out lots of stuff,
like this:
%post core
case "$*" in
  2)
    # Upgrading so try and restart if already running
    # For systemctl systems we need to reload the configs
    # becaues it'll complain if we just installed a new
    # init script
    #%if 0%{?use_systemd}
    #  systemctl daemon-reload
    #  systemctl condrestart %{name}.service
    #%else
    #  /etc/init.d/%{name} condrestart &>/dev/null || true
    #%endif
  ;;

I think (I am not an expert) upstream is trying to handle updates
without having to restart the service, but this does not allow builds
on OBS.

My Question is if there is a 'openSUSE'-way of doing things like that?
Is there any 'best practice' to do that? Any do's and dont's?

(I have not thoroughly looked into the differences between the
upstream spec and Lars lrupp's spec file in server:monitoring due to
there being so many differences, maybe Lars already added some of this)

Any hints are highly appreciated.

Johannes


signature.asc (900 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Packaging naemon: Handling systemd-related stuff in %post

Simon Lees-3


On 05/11/2017 05:52 AM, Johannes Kastl wrote:

> Hi guys,
>
> I stumbled upon the naemon package in server:monitoring, and gave
> building naemon from the upstream spec a try:
>
> home:ojkastl_buildservice:Naemon_upstream
>
> I also tried to update the package in server:monitoring:
> home:ojkastl_buildservice:branches:server:monitoring
>
> I got both of them to build, but only by commenting out lots of stuff,
> like this:
> %post core
> case "$*" in
>   2)
>     # Upgrading so try and restart if already running
>     # For systemctl systems we need to reload the configs
>     # becaues it'll complain if we just installed a new
>     # init script
>     #%if 0%{?use_systemd}
>     #  systemctl daemon-reload
>     #  systemctl condrestart %{name}.service
>     #%else
>     #  /etc/init.d/%{name} condrestart &>/dev/null || true
>     #%endif
>   ;;
>
> I think (I am not an expert) upstream is trying to handle updates
> without having to restart the service, but this does not allow builds
> on OBS.
>
> My Question is if there is a 'openSUSE'-way of doing things like that?
> Is there any 'best practice' to do that? Any do's and dont's?
>
> (I have not thoroughly looked into the differences between the
> upstream spec and Lars lrupp's spec file in server:monitoring due to
> there being so many differences, maybe Lars already added some of this)
>
> Any hints are highly appreciated.
>
> Johannes
>
https://en.opensuse.org/openSUSE:Systemd_packaging_guidelines covers
most of the basics for packaging systemd things on openSUSE, the macro's
should take care of everything for you. Once you are using them then
"export DISABLE_RESTART_ON_UPDATE=yes" in the %postun section will
prevent that.

--

Simon Lees (Simotek)                            http://simotek.net

Emergency Update Team                           keybase.io/simotek
SUSE Linux                           Adelaide Australia, UTC+10:30
GPG Fingerprint: 5B87 DB9D 88DC F606 E489 CEC5 0922 C246 02F0 014B


signature.asc (499 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Packaging naemon: Handling systemd-related stuff in %post

Johannes Kastl-2
Hi Simon,

On 11.05.17 02:51 Simon Lees wrote:

>> My Question is if there is a 'openSUSE'-way of doing things like
>> that? Is there any 'best practice' to do that? Any do's and
>> dont's?

> https://en.opensuse.org/openSUSE:Systemd_packaging_guidelines
> covers most of the basics for packaging systemd things on openSUSE,
> the macro's should take care of everything for you. Once you are
> using them then "export DISABLE_RESTART_ON_UPDATE=yes" in the
> %postun section will prevent that.

Thanks for the answer, I take that as a "yes" that the functionality
can be kept while getting the package to build on OBS and complying to
the rules/policies. ;-)

I'll dig into that and come back, if I encounter major issues.

Have a nice day everyone!

Johannes


signature.asc (900 bytes) Download Attachment