Accepting request 877267 from Base:System

- Bump to version 11

- Don't pass -f to rm in %service_add_post nor %systemd_user_post

- Add a %systemd_user_pre macro that creates a
  /run/systemd/rpm/needs-user-preset/$service file for each new
  service being installed so %systemd_user_post can call
  `systemctl --global preset $service` properly for newly
  installed user services (boo#1183051, boo#1183012).

- Fix %systemd_user_post. The --global parameter was handled as if
  it was another service name so %systemd_user_post wasn't working
  properly. Replace %systemd_user_post with the code from
  %service_add_post it was being expanded to but correctly passing
  --global to systemctl (boo#1183051, boo#1182661).

OBS-URL: https://build.opensuse.org/request/show/877267
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd-rpm-macros?expand=0&rev=34
This commit is contained in:
Dominique Leuenberger 2021-03-11 19:06:48 +00:00 committed by Git OBS Bridge
commit 35bb9dbe84
3 changed files with 51 additions and 3 deletions

View File

@ -101,7 +101,7 @@ if [ -x /usr/bin/systemctl ]; then \
for service in %{?*} ; do \
if [ -e "/run/systemd/rpm/needs-preset/$service" ]; then \
/usr/bin/systemctl preset "$service" || : \
rm -f /run/systemd/rpm/needs-preset/$service \
rm "/run/systemd/rpm/needs-preset/$service" || : \
else \
/usr/lib/systemd/systemd-sysv-convert --apply %{?*} || : \
fi \
@ -172,7 +172,27 @@ fi \
%systemd_postun() %{expand::%%service_del_postun_without_restart %{?**}}
%systemd_postun_with_restart() %{expand::%%service_del_postun %{?**}}
%systemd_user_post() %{expand:%systemd_post \\--global %%{?*}}
%systemd_user_pre() \
if [ -x /usr/bin/systemctl ]; then \
for service in %{?*} ; do \
if [ ! -e "/usr/lib/systemd/user/$service" ]; then \
mkdir -p /run/systemd/rpm/needs-user-preset \
touch "/run/systemd/rpm/needs-user-preset/$service" \
fi \
done \
fi \
%{nil}
%systemd_user_post() \
if [ -x /usr/bin/systemctl ]; then \
for service in %{?*} ; do \
if [ -e "/run/systemd/rpm/needs-user-preset/$service" ]; then \
/usr/bin/systemctl --global preset "$service" || : \
rm "/run/systemd/rpm/needs-user-preset/$service" || : \
fi \
done \
fi \
%{nil}
%systemd_user_preun() \
if [ $1 -eq 0 -a -x /usr/bin/systemctl ]; then \

View File

@ -1,3 +1,31 @@
-------------------------------------------------------------------
Fri Mar 5 12:27:14 UTC 2021 - Franck Bui <fbui@suse.com>
- Bump to version 11
-------------------------------------------------------------------
Fri Mar 5 11:10:16 UTC 2021 - Antonio Larrosa <alarrosa@suse.com>
- Don't pass -f to rm in %service_add_post nor %systemd_user_post
-------------------------------------------------------------------
Fri Mar 5 11:03:49 UTC 2021 - Antonio Larrosa <alarrosa@suse.com>
- Add a %systemd_user_pre macro that creates a
/run/systemd/rpm/needs-user-preset/$service file for each new
service being installed so %systemd_user_post can call
`systemctl --global preset $service` properly for newly
installed user services (boo#1183051, boo#1183012).
-------------------------------------------------------------------
Thu Mar 4 13:11:15 UTC 2021 - Antonio Larrosa <alarrosa@suse.com>
- Fix %systemd_user_post. The --global parameter was handled as if
it was another service name so %systemd_user_post wasn't working
properly. Replace %systemd_user_post with the code from
%service_add_post it was being expanded to but correctly passing
--global to systemctl (boo#1183051, boo#1182661).
-------------------------------------------------------------------
Fri Feb 12 11:46:17 UTC 2021 - Franck Bui <fbui@suse.com>

View File

@ -17,7 +17,7 @@
Name: systemd-rpm-macros
Version: 10
Version: 11
Release: 0
Summary: RPM macros for systemd
License: LGPL-2.1-or-later