From 7d56316590e20d2a6ed6550f34c1039c46d815005254660ce51db12169089118 Mon Sep 17 00:00:00 2001 From: Egbert Eich Date: Fri, 20 Apr 2018 09:24:13 +0000 Subject: [PATCH] Accepting request 599201 from home:eeich:branches:network:cluster - Avoid running pretrans scripts when running in an instsys: there may be not much installed, yet. pretrans code should be done in lua, this way, it will be executed by the rpm-internal lua interpreter and not be passed to a shell which may not be around at the time this scriptlet is run (bsc#1090292). OBS-URL: https://build.opensuse.org/request/show/599201 OBS-URL: https://build.opensuse.org/package/show/network:cluster/slurm?expand=0&rev=56 --- slurm.changes | 9 +++++++++ slurm.spec | 15 +++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/slurm.changes b/slurm.changes index 36862c9..3044217 100644 --- a/slurm.changes +++ b/slurm.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Thu Apr 19 21:05:04 UTC 2018 - eich@suse.com + +- Avoid running pretrans scripts when running in an instsys: + there may be not much installed, yet. pretrans code should + be done in lua, this way, it will be executed by the rpm-internal + lua interpreter and not be passed to a shell which may not be + around at the time this scriptlet is run (bsc#1090292). + ------------------------------------------------------------------- Fri Apr 13 10:03:05 UTC 2018 - eich@suse.com diff --git a/slurm.spec b/slurm.spec index 19491df..7889afc 100644 --- a/slurm.spec +++ b/slurm.spec @@ -564,18 +564,25 @@ exit 0 # plugins has changed as updates are not atomic. Since we cannot # fix the old scripts we need these macros as a workaround. # They should be removed at some point. -%define _test_rest() %{?with_systemd:rm -f /run/%{1}.rst; systemctl status %{1} &>/dev/null && touch /run/%{1}.rst || :;} +# Do pretrans in lua: https://fedoraproject.org/wiki/Packaging:Scriptlets +%define _test_rest() %{?with_systemd: os.remove("/run/%{1}.rst") + if os.execute() and os.getenv("YAST_IS_RUNNING") ~= "instsys" then + if os.execute("systemctl status %{1} &>/dev/null") then + f=io.open("/run/%{1}.rst","w"); f:close() + end + end +} %define _rest() %{?with_systemd:[ -e /run/%{1}.rst ] && { systemctl status %{1} &>/dev/null || systemctl restart %{1}; }; rm -f /run/%{1}.rst;} # Until a posttrans macro has been added to macros.systemd, we need this %define _res_update() %{?with_systemd:%{expand:%%_restart_on_update %{?*}};} -%pretrans +%pretrans -p %_test_rest slurmctld -%pretrans node +%pretrans node -p %_test_rest slurmd -%pretrans slurmdbd +%pretrans slurmdbd -p %_test_rest slurmdbd %posttrans