[DTrace-devel] [PATCH] spec, dtprobed: restart on install/update if already running

Eugene Loh eugene.loh at oracle.com
Wed Jun 7 17:52:33 UTC 2023


Reviewed-by: Eugene Loh <eugene.loh at oracle.com>
but that's because you say you tested it and hoping Kris will take a look.

On 6/7/23 13:14, Nick Alcock via DTrace-devel wrote:
> If we don't restart dtprobed when a yum update happens, we're going to
> keep running an older version, with all its bugs and/or limitations.  I
> thought %systemd_postun handled this, but in fact it doesn't: you need
> to use the barely-documented %systemd_postun_with_restart instead.  Of
> course, that doesn't really work: being in %postun, the *package being
> uninstalled* already needs to have it.  So do a try-restart in %post
> instead, so that the new version gets it. If we do a try-restart before
> the enable/start, it should work fine even on first install, when it's
> not already running.
>
> While we're at it, fix %systemd_postun to not mention .targets,
> only .services: it doesn't make sense to stop targets :)
>
> Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
> ---
>   dtrace.spec | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/dtrace.spec b/dtrace.spec
> index d525386f15e8..92d10e4d876b 100644
> --- a/dtrace.spec
> +++ b/dtrace.spec
> @@ -198,6 +198,10 @@ rm -rf $RPM_BUILD_DIR/%{name}-%{version}
>   /sbin/ldconfig
>   %udev_rules_update
>   %systemd_post dtprobed.service dtrace-usdt.target
> +# Do this rather than systemd_postun_with_restart because this depends
> +# only on the package being installed, rather than relying on the state of
> +# the old package.
> +systemctl try-restart dtprobed || :
>   systemctl enable dtprobed.service dtrace-usdt.target
>   systemctl start dtprobed.service
>   
> @@ -216,7 +220,7 @@ fi
>   %postun
>   /sbin/ldconfig
>   %udev_rules_update
> -%systemd_postun dtprobed.service dtrace-usdt.target
> +%systemd_postun dtprobed.service
>   
>   %files
>   %defattr(-,root,root,-)
>
> base-commit: 54eaa8936464e11d290660a4f6d49074086d7124



More information about the DTrace-devel mailing list