spec: Only run worker preun if systemd is running
Before, when systemd was not present (for instance in a container), the preun script would error out. This checks if systemd is present and running in the same way the systemd rpm macros do. Fixes #1915
This commit is contained in:
parent
03074303cc
commit
117886a75f
1 changed files with 5 additions and 4 deletions
|
|
@ -349,10 +349,11 @@ The worker for osbuild-composer
|
|||
# systemd_preun uses systemctl disable --now which doesn't work well with template services.
|
||||
# See https://github.com/systemd/systemd/issues/15620
|
||||
# The following lines mimicks its behaviour by running two commands:
|
||||
|
||||
# disable and stop all the worker services
|
||||
systemctl --no-reload disable osbuild-worker@.service osbuild-remote-worker@.service
|
||||
systemctl stop "osbuild-worker@*.service" "osbuild-remote-worker@*.service"
|
||||
if [ -d /run/systemd/system ]; then
|
||||
# disable and stop all the worker services
|
||||
systemctl --no-reload disable osbuild-worker@.service osbuild-remote-worker@.service
|
||||
systemctl stop "osbuild-worker@*.service" "osbuild-remote-worker@*.service"
|
||||
fi
|
||||
|
||||
%postun worker
|
||||
# restart all the worker services
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue