From 34c8551a8b16bf235a1ebe8d9cb1a3474a7c975e Mon Sep 17 00:00:00 2001
From: Peter Kjellerstedt <pkj@axis.com>
Date: Fri, 22 Aug 2025 18:07:28 +0200
Subject: [PATCH] systemctl: Call systemd-sysv-install without path

Expect to find systemd-sysv-install in $PATH instead of hardcoding the
path to it, as the latter does not work when running systemctl from a
recipe sysroot.

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Upstream-Status: Inappropriate [OE specific]
---
 src/systemctl/systemctl-sysv-compat.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/systemctl/systemctl-sysv-compat.c b/src/systemctl/systemctl-sysv-compat.c
index cb9c43e3dc..e44ef9f64e 100644
--- a/src/systemctl/systemctl-sysv-compat.c
+++ b/src/systemctl/systemctl-sysv-compat.c
@@ -140,7 +140,7 @@ int enable_sysv_units(const char *verb, char **args) {
         while (args[f]) {
 
                 const char *argv[] = {
-                        LIBEXECDIR "/systemd-sysv-install",
+                        "systemd-sysv-install",
                         NULL, /* --root= */
                         NULL, /* verb */
                         NULL, /* service */
@@ -218,7 +218,7 @@ int enable_sysv_units(const char *verb, char **args) {
                         return j;
                 if (j == 0) {
                         /* Child */
-                        execv(argv[0], (char**) argv);
+                        execvp(argv[0], (char**) argv);
                         log_error_errno(errno, "Failed to execute %s: %m", argv[0]);
                         _exit(EXIT_FAILURE);
                 }
