How to reload D-Bus by RPM macros?
I packaging timekps-next for openSUSE in OBS, that install a D-Bus rules for group access to service. How I can reload D-Bus daemon to refresh access policies for Timekpr-nExT daemon by RPM scriptlets? DEB postinst script contain: echo "Reloading dbus daemon to refresh access policies for Timekpr-nExT daemon" systemctl reload dbus Is the anyway for done this with RPM? Now, access works only after reboot.
Hello Alexey, Am Mittwoch, 20. November 2024, 10:13:28 Mitteleuropäische Normalzeit schrieb Alexey Svistunov:
I packaging timekps-next for openSUSE in OBS, that install a D-Bus rules for group access to service. How I can reload D-Bus daemon to refresh access policies for Timekpr-nExT daemon by RPM scriptlets? DEB postinst script contain: echo "Reloading dbus daemon to refresh access policies for Timekpr-nExT daemon" systemctl reload dbus Is the anyway for done this with RPM? Now, access works only after reboot.
Did you add the command already to the %post section? HTH Axel
20.11.2024 17:34, Axel Braun пишет:
Hello Alexey,
Am Mittwoch, 20. November 2024, 10:13:28 Mitteleuropäische Normalzeit schrieb Alexey Svistunov:
Did you add the command already to the %post section?
HTH Axel
OBS and chroot build environments does not provide systemd, the build ends with an error: /var/tmp/rpm-tmp.m5llyB: line 7: sysetmctl: command not found warning: %post(timekpr-next-0.5.7-0.noarch) scriptlet failed, exit status 127
On Thu, Nov 21, 2024 at 9:52 AM Alexey Svistunov <svalx@svalx.net> wrote:
20.11.2024 17:34, Axel Braun пишет:
Hello Alexey,
Am Mittwoch, 20. November 2024, 10:13:28 Mitteleuropäische Normalzeit schrieb Alexey Svistunov:
Did you add the command already to the %post section?
HTH Axel
OBS and chroot build environments does not provide systemd, the build ends with an error: /var/tmp/rpm-tmp.m5llyB: line 7: sysetmctl: command not found
It is systemctl, not sysetmctl
warning: %post(timekpr-next-0.5.7-0.noarch) scriptlet failed, exit status 127
21.11.2024 10:03, Andrei Borzenkov пишет:
It is systemctl, not sysetmctl
Thank you, Andrey, but unfortunately, that's not the point: ` %post %service_add_post %{shortname}.service systemctl reload dbus ` [ 28s] /.build_patchrpmcheck_scr: line 7: systemctl: command not found [ 28s] postinstall script of timekpr-next-0.5.7-0.noarch.rpm failed
On Thu, Nov 21, 2024 at 10:12 AM Alexey Svistunov <svalx@svalx.net> wrote:
21.11.2024 10:03, Andrei Borzenkov пишет:
It is systemctl, not sysetmctl
Thank you, Andrey, but unfortunately, that's not the point:
` %post %service_add_post %{shortname}.service systemctl reload dbus `
[ 28s] /.build_patchrpmcheck_scr: line 7: systemctl: command not found [ 28s] postinstall script of timekpr-next-0.5.7-0.noarch.rpm failed
Assuming this is your project (I cannot find and timekps and you did not provide any link): https://build.opensuse.org/package/show/home:svalx/timekpr-next - I do not see any build failures.
Am Donnerstag, 21. November 2024, 10:15:59 Mitteleuropäische Normalzeit schrieb Andrei Borzenkov:
On Thu, Nov 21, 2024 at 10:12 AM Alexey Svistunov <svalx@svalx.net> wrote:
21.11.2024 10:03, Andrei Borzenkov пишет:
It is systemctl, not sysetmctl
Thank you, Andrey, but unfortunately, that's not the point:
` %post %service_add_post %{shortname}.service systemctl reload dbus `
[ 28s] /.build_patchrpmcheck_scr: line 7: systemctl: command not found [ 28s] postinstall script of timekpr-next-0.5.7-0.noarch.rpm failed
Assuming this is your project (I cannot find and timekps and you did not provide any link): https://build.opensuse.org/package/show/home:svalx/timekpr-next - I do not see any build failures.
..because in the version on OBS he does not call systemctl.. Did you try to add a BuildRequires for systemctl? Cheers Axel
21.11.2024 12:24, Axel Braun пишет:
Am Donnerstag, 21. November 2024, 10:15:59 Mitteleuropäische Normalzeit schrieb Andrei Borzenkov:
..because in the version on OBS he does not call systemctl.. Did you try to add a BuildRequires for systemctl?
Yes, adding 'Requires(post): systemd' helped me. Many thanks to everyone who responded!
21.11.2024 12:15, Andrei Borzenkov пишет:
On Thu, Nov 21, 2024 at 10:12 AM Alexey Svistunov <svalx@svalx.net> wrote:
Assuming this is your project (I cannot find and timekps and you did not provide any link): https://build.opensuse.org/package/show/home:svalx/timekpr-next
Yes it is.
- I do not see any build failures.
I am testing the build in a local environment before submitting the changes to OBS.
On Thursday 2024-11-21 08:11, Alexey Svistunov wrote:
21.11.2024 10:03, Andrei Borzenkov пишет:
It is systemctl, not sysetmctl
Thank you, Andrey, but unfortunately, that's not the point:
` %post %service_add_post %{shortname}.service systemctl reload dbus `
openSUSE also supports container environments without systemd (or any other general process manager), so you have to cope with the absence of it.
Hi Alexey, Alexey Svistunov <svalx@svalx.net> writes:
20.11.2024 17:34, Axel Braun пишет:
Hello Alexey,
Am Mittwoch, 20. November 2024, 10:13:28 Mitteleuropäische Normalzeit schrieb Alexey Svistunov:
Did you add the command already to the %post section?
HTH Axel
OBS and chroot build environments does not provide systemd, the build ends with an error: /var/tmp/rpm-tmp.m5llyB: line 7: sysetmctl: command not found warning: %post(timekpr-next-0.5.7-0.noarch) scriptlet failed, exit status 127
The usual approach would be: --8<---------------cut here---------------start------------->8--- if [ -x /usr/bin/systemctl ]; then /usr/bin/systemctl restart foo || : fi --8<---------------cut here---------------end--------------->8--- or use one of the `%service_*` macros if appropriate[1] Cheers, Dan -- Dan Čermák <dcermak@suse.com> Software Engineer Development tools SUSE Software Solutions Germany GmbH Frankenstr. 146 90461 Nürnberg Germany www.suse.com Geschäftsführer: Ivo Totev, Andrew McDonald, Werner Knoblich (HRB 36809, AG Nürnberg) Footnotes: [1] https://en.opensuse.org/openSUSE:Systemd_packaging_guidelines
On Thu, Nov 21, 2024 at 12:54 PM Dan Čermák <dcermak@suse.com> wrote:
Hi Alexey,
Alexey Svistunov <svalx@svalx.net> writes:
20.11.2024 17:34, Axel Braun пишет:
Hello Alexey,
Am Mittwoch, 20. November 2024, 10:13:28 Mitteleuropäische Normalzeit schrieb Alexey Svistunov:
Did you add the command already to the %post section?
HTH Axel
OBS and chroot build environments does not provide systemd, the build ends with an error: /var/tmp/rpm-tmp.m5llyB: line 7: sysetmctl: command not found warning: %post(timekpr-next-0.5.7-0.noarch) scriptlet failed, exit status 127
The usual approach would be:
--8<---------------cut here---------------start------------->8--- if [ -x /usr/bin/systemctl ]; then /usr/bin/systemctl restart foo || : fi --8<---------------cut here---------------end--------------->8---
or use one of the `%service_*` macros if appropriate[1]
%service_add_post if [ -x /usr/lib/systemd/systemd-update-helper ]; then \ /usr/lib/systemd/systemd-update-helper install-system-units %{?*} || : \ fi \ and systemd-update-helper just unconditionally calls systemctl. I still try to understand at which point the %post is invoked during *build*.
On Thu, Nov 21, 2024 at 12:03 PM Andrei Borzenkov <arvidjaar@gmail.com> wrote:
I still try to understand at which point the %post is invoked during *build*.
When the package gets installed/deinstalled to verify, that your %post/%postun scripts work and are not broken. To prevent this kind of broken %post installs, which makes wrong assumptions what's available and what not. Thorsten -- Thorsten Kukuk, Distinguished Engineer, Senior Architect, Future Technologies SUSE Software Solutions Germany GmbH, Frankenstraße 146, 90461 Nuernberg, Germany Managing Director: Ivo Totev, Andrew McDonald, Werner Knoblich (HRB 36809, AG Nürnberg)
Andrei Borzenkov <arvidjaar@gmail.com> writes:
On Thu, Nov 21, 2024 at 12:54 PM Dan Čermák <dcermak@suse.com> wrote:
Hi Alexey,
Alexey Svistunov <svalx@svalx.net> writes:
20.11.2024 17:34, Axel Braun пишет:
Hello Alexey,
Am Mittwoch, 20. November 2024, 10:13:28 Mitteleuropäische Normalzeit schrieb Alexey Svistunov:
Did you add the command already to the %post section?
HTH Axel
OBS and chroot build environments does not provide systemd, the build ends with an error: /var/tmp/rpm-tmp.m5llyB: line 7: sysetmctl: command not found warning: %post(timekpr-next-0.5.7-0.noarch) scriptlet failed, exit status 127
The usual approach would be:
--8<---------------cut here---------------start------------->8--- if [ -x /usr/bin/systemctl ]; then /usr/bin/systemctl restart foo || : fi --8<---------------cut here---------------end--------------->8---
or use one of the `%service_*` macros if appropriate[1]
%service_add_post if [ -x /usr/lib/systemd/systemd-update-helper ]; then \ /usr/lib/systemd/systemd-update-helper install-system-units %{?*} || : \ fi \
and systemd-update-helper just unconditionally calls systemctl.
I still try to understand at which point the %post is invoked during *build*.
afaik %post is invoked by osc to check the scriptlets, but I am not sure which mechanism does this exactly. -- Dan Čermák <dcermak@suse.com> Software Engineer Development tools SUSE Software Solutions Germany GmbH Frankenstr. 146 90461 Nürnberg Germany www.suse.com Geschäftsführer: Ivo Totev, Andrew McDonald, Werner Knoblich (HRB 36809, AG Nürnberg)
On Thu, Nov 21, 2024 at 4:03 PM Dan Čermák <dcermak@suse.com> wrote:
Andrei Borzenkov <arvidjaar@gmail.com> writes:
On Thu, Nov 21, 2024 at 12:54 PM Dan Čermák <dcermak@suse.com> wrote:
Hi Alexey,
Alexey Svistunov <svalx@svalx.net> writes:
20.11.2024 17:34, Axel Braun пишет:
Hello Alexey,
Am Mittwoch, 20. November 2024, 10:13:28 Mitteleuropäische Normalzeit schrieb Alexey Svistunov:
Did you add the command already to the %post section?
HTH Axel
OBS and chroot build environments does not provide systemd, the build ends with an error: /var/tmp/rpm-tmp.m5llyB: line 7: sysetmctl: command not found warning: %post(timekpr-next-0.5.7-0.noarch) scriptlet failed, exit status 127
The usual approach would be:
--8<---------------cut here---------------start------------->8--- if [ -x /usr/bin/systemctl ]; then /usr/bin/systemctl restart foo || : fi --8<---------------cut here---------------end--------------->8---
or use one of the `%service_*` macros if appropriate[1]
%service_add_post if [ -x /usr/lib/systemd/systemd-update-helper ]; then \ /usr/lib/systemd/systemd-update-helper install-system-units %{?*} || : \ fi \
and systemd-update-helper just unconditionally calls systemctl.
OK, it does check for systemd-update-helper which is installed by systemd package that also installs systemctl. So, it does indirectly check for systemctl availability. So if systemctl is invoked manually, the equivalent check is indeed [ -x /usr/bin/systemctl ].
participants (6)
-
Alexey Svistunov
-
Andrei Borzenkov
-
Axel Braun
-
Dan Čermák
-
Jan Engelhardt
-
Thorsten Kukuk