From ae67a8952ccde5a11be8915958de774d14efde64 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 13 Jul 2021 08:45:40 +0200 Subject: [PATCH] helpers.cpp: fix fallback to 'service' as default command Our buildsystem/image (Yocto/OE) is using systemctl as default and we have defined 'systemctl' as 3rd parameter (e.g. see drivers/lcd4l.cpp), but users of our source could use systems without 'systemctl' in their own buildsystems/images, therefore it makes sense to have a fallback to 'service'. This should avoid patching the sources. Thx GetAway for hint. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/8870512979c9311da4366a6d45adfa12ceab947b Author: Thilo Graf Date: 2021-07-13 (Tue, 13 Jul 2021) --- src/system/helpers.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index 260185029..f85370d8c 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -581,11 +581,11 @@ bool exec_initscript(std::string script, std::string command, std::string system const std::string sysctl_bin = "systemctl"; bool use_systemd = !find_executable(sysctl_bin.c_str()).empty(); - std::string sys_command = use_systemd ? sysctl_bin : system_command; + std::string sys_command = use_systemd ? sysctl_bin : "service"; // fallback to 'service' if no 'systemctl' was found std::string cmd = command; int ret = 1; - if (!use_systemd) // 'service' or what ever + if (!use_systemd) // default { dprintf(DEBUG_DEBUG, "executing %s %s %s\n", sys_command.c_str(), script.c_str(), cmd.c_str()); ret = my_system(3, sys_command.c_str(), script.c_str(), cmd.c_str());