mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 16:01:20 +02:00
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.
This commit is contained in:
@@ -480,11 +480,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());
|
||||
|
Reference in New Issue
Block a user