diff options
| author | Artur Kowalski <arturkow2000@gmail.com> | 2025-01-20 13:46:02 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-01-21 12:07:56 +0000 |
| commit | a3302b821600119b3e346ed10f0ffa3c3533e77c (patch) | |
| tree | 9cfbb76ea5b8653cc8013a038c77b16ea2808a7a | |
| parent | 8c5a6ca6f991c65eac1d6b4235fddc6e99778501 (diff) | |
| download | poky-a3302b821600119b3e346ed10f0ffa3c3533e77c.tar.gz | |
systemd.bbclass: introduce systemd_service_searchpaths()
systemd_service_searchpaths accepts boolean value indicating whether we
are dealing with system or user units and returns search paths
accordingly.
Previously search path list was created in systemd_check_services() but
following commits will introduce additional places. The
systemd_service_searchpaths helper function is meant to reduce code
duplication.
(From OE-Core rev: 9a89d36932dda306b3c2cf10771647eabc267769)
Signed-off-by: Artur Kowalski <arturkow2000@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/classes-recipe/systemd.bbclass | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/meta/classes-recipe/systemd.bbclass b/meta/classes-recipe/systemd.bbclass index 14fef2d7a6..a3c2c6eb20 100644 --- a/meta/classes-recipe/systemd.bbclass +++ b/meta/classes-recipe/systemd.bbclass | |||
| @@ -90,6 +90,18 @@ def systemd_service_path(service, searchpaths, d): | |||
| 90 | 90 | ||
| 91 | return path_found, base | 91 | return path_found, base |
| 92 | 92 | ||
| 93 | def systemd_service_searchpaths(user, d): | ||
| 94 | if user: | ||
| 95 | return [ | ||
| 96 | oe.path.join(d.getVar("sysconfdir"), "systemd", "user"), | ||
| 97 | d.getVar("systemd_user_unitdir"), | ||
| 98 | ] | ||
| 99 | else: | ||
| 100 | return [ | ||
| 101 | oe.path.join(d.getVar("sysconfdir"), "systemd", "system"), | ||
| 102 | d.getVar("systemd_system_unitdir"), | ||
| 103 | ] | ||
| 104 | |||
| 93 | python systemd_populate_packages() { | 105 | python systemd_populate_packages() { |
| 94 | import re | 106 | import re |
| 95 | import shlex | 107 | import shlex |
| @@ -169,12 +181,9 @@ python systemd_populate_packages() { | |||
| 169 | 181 | ||
| 170 | # Check service-files and call systemd_add_files_and_parse for each entry | 182 | # Check service-files and call systemd_add_files_and_parse for each entry |
| 171 | def systemd_check_services(): | 183 | def systemd_check_services(): |
| 172 | searchpaths = [ | 184 | searchpaths = systemd_service_searchpaths(False, d) |
| 173 | oe.path.join(d.getVar("sysconfdir"), "systemd", "system"), | 185 | searchpaths.extend(systemd_service_searchpaths(True, d)) |
| 174 | oe.path.join(d.getVar("sysconfdir"), "systemd", "user"), | 186 | |
| 175 | ] | ||
| 176 | searchpaths.append(d.getVar("systemd_system_unitdir")) | ||
| 177 | searchpaths.append(d.getVar("systemd_user_unitdir")) | ||
| 178 | systemd_packages = d.getVar('SYSTEMD_PACKAGES') | 187 | systemd_packages = d.getVar('SYSTEMD_PACKAGES') |
| 179 | 188 | ||
| 180 | # scan for all in SYSTEMD_SERVICE[] | 189 | # scan for all in SYSTEMD_SERVICE[] |
