fix: support ExecSearchPath to prevent systemd from not finding binaries

In NixOS, maintainer used a patch to modify the DEFAULT_PATH macro of systemd.
However, systemd can only find its own binaries under that path.
At this point, if you take the relative path of the binary as a parameter to StartTransientUnit,
systemd will use DEFAULT_PATH to look for the binary, which will cause systemd to not find it.

There may be other Linux distributions that change this path,
so add ExecSearchPath to prevent systemd from not finding the binary.

Signed-off-by: ComixHe <heyuming@deepin.org>
This commit is contained in:
ComixHe
2024-02-01 17:30:59 +08:00
committed by Comix
parent bcb9d0c3e5
commit aca0531e85
10 changed files with 118 additions and 47 deletions

View File

@ -142,7 +142,8 @@ int processExecStart(msg_ptr &msg, const std::deque<std::string_view> &execArgs)
DBusValueType getPropType(std::string_view key)
{
static std::unordered_map<std::string_view, DBusValueType> map{{"Environment", DBusValueType::ArrayOfString},
{"WorkingDirectory", DBusValueType::String}};
{"WorkingDirectory", DBusValueType::String},
{"ExecSearchPath", DBusValueType::ArrayOfString}};
if (auto it = map.find(key); it != map.cend()) {
return it->second;