]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
systemd: use if..then in prerm scriptlet
authorDaniel McGregor <daniel.mcgregor@vecima.com>
Tue, 23 Sep 2025 19:01:46 +0000 (13:01 -0600)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 25 Sep 2025 09:57:21 +0000 (10:57 +0100)
Using the [ test ] && foo construct in the prerm scriptlet causes
the prerm scriptlet to fail if the final test condition fails, which
with rpm prevents the removal of the package. Switch to using
if;then;fi instead, since it doesn't cause the scriptlet to fail.

Signed-off-by: Daniel McGregor <daniel.mcgregor@vecima.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes-recipe/systemd.bbclass

index 4e687135f13317936756189c87832c97b72168da..5a0550b287b4f2803543dd446888a79affe70b16 100644 (file)
@@ -74,8 +74,9 @@ if type systemctl >/dev/null 2>/dev/null; then
                fi
 
                # same as above, --global flag is not supported for stop so do disable only
-               [ -n "${@systemd_filter_services("${SYSTEMD_SERVICE_ESCAPED}", True, d)}" ] && \
+               if [ -n "${@systemd_filter_services("${SYSTEMD_SERVICE_ESCAPED}", True, d)}" ]; then
                        systemctl --global disable ${@systemd_filter_services("${SYSTEMD_SERVICE_ESCAPED}", True, d)}
+               fi
        fi
 fi
 }