1From 209f346d55eeaf74e21c541d70ec43d39b6c8c3c Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 27 May 2023 17:22:10 -0700
4Subject: [PATCH] cmake: Allow SYSTEMCTL_BIN to be overridden from environment
5
6This allows to encode correct paths which are inside the target rootfs
7for systemctl
8
9Upstream-Status: Pending
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11
12---
13 CMakeLists.txt | 5 ++++-
14 1 file changed, 4 insertions(+), 1 deletion(-)
15
16diff --git a/CMakeLists.txt b/CMakeLists.txt
17index 98985e7ee..001efb800 100644
18--- a/CMakeLists.txt
19+++ b/CMakeLists.txt
20@@ -237,7 +237,10 @@ else()
21   endif()
22 endif()
23
24-find_program(SYSTEMCTL_BIN systemctl HINTS "/usr/bin" "/bin")
25+if (NOT SYSTEMCTL_BIN)
26+  find_program(SYSTEMCTL_BIN systemctl HINTS "/usr/bin" "/bin")
27+endif()
28+
29 if (NOT SYSTEMCTL_BIN)
30   set (SYSTEMCTL_BIN "/bin/systemctl")
31 endif()
32