]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemd-path: add 'system-search-configuration' 39684/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 13 Nov 2025 13:02:30 +0000 (14:02 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 13 Nov 2025 13:11:11 +0000 (14:11 +0100)
This provides functionality to replace what was provided by the preceding
revert:

  $ build/systemd-path system-search-configuration --suffix=sysctl.d
  /etc/sysctl.d:/run/sysctl.d:/usr/local/lib/sysctl.d:/usr/lib/sysctl.d

The result is identical, but more generic, since by changing suffix we can also
get the answer for sysusers.d, tmpfiles.d, and any other of the directories
which follow the same general rule.

man/sd_path_lookup.xml
src/libsystemd/sd-path/sd-path.c
src/path/path-tool.c
src/systemd/sd-path.h
test/units/TEST-74-AUX-UTILS.path.sh

index fc6bac640c9fcd17c7e1c1402151f09f6b860e50..9190e6b00a49a15b593b8edbdfe1680e0143cb41 100644 (file)
@@ -41,6 +41,7 @@
         <constant>SD_PATH_SYSTEM_STATE_FACTORY</constant>,
 
         <constant>SD_PATH_SYSTEM_CONFIGURATION</constant>,
+        <constant>SD_PATH_SYSTEM_SEARCH_CONFIGURATION</constant>,
         <constant>SD_PATH_SYSTEM_RUNTIME</constant>,
         <constant>SD_PATH_SYSTEM_RUNTIME_LOGS</constant>,
         <constant>SD_PATH_SYSTEM_STATE_PRIVATE</constant>,
index 0096997135357a6e55f0453cde88ae535e713151..b80b8ca68d23295c217601e46d3e8f966a052cce 100644 (file)
@@ -524,6 +524,9 @@ static int get_search(uint64_t type, char ***ret) {
 
         switch (type) {
 
+        case SD_PATH_SYSTEM_SEARCH_CONFIGURATION:
+                return strv_from_nulstr(ret, CONF_PATHS_NULSTR(""));
+
         case SD_PATH_SEARCH_BINARIES:
                 return search_from_environment(ret,
                                                NULL,
index 3dc31832b38cba9ed31b8755981ad5ab53b285d9..227468dfe8f09cce6f78e78d3c6b73d9d1fd54fb 100644 (file)
@@ -22,6 +22,8 @@ static const char* const path_table[_SD_PATH_MAX] = {
         [SD_PATH_TEMPORARY]                                   = "temporary",
         [SD_PATH_TEMPORARY_LARGE]                             = "temporary-large",
 
+        [SD_PATH_SYSTEM_SEARCH_CONFIGURATION]                 = "system-search-configuration",
+
         [SD_PATH_SYSTEM_BINARIES]                             = "system-binaries",
         [SD_PATH_SYSTEM_INCLUDE]                              = "system-include",
         [SD_PATH_SYSTEM_LIBRARY_PRIVATE]                      = "system-library-private",
index eb42e31a689ccf39bf6ed17ce16982d16cb29b8a..2718cf82664755e3e4d1bf884a6a1f626cbfab1c 100644 (file)
@@ -44,6 +44,9 @@ __extension__ enum {
         SD_PATH_SYSTEM_STATE_CACHE,
         SD_PATH_SYSTEM_STATE_SPOOL,
 
+        /* generic system configuration */
+        SD_PATH_SYSTEM_SEARCH_CONFIGURATION,
+
         /* Vendor supplied data */
         SD_PATH_USER_BINARIES,
         SD_PATH_USER_LIBRARY_PRIVATE,
index 79056a5b2bb3df6b660b3e8e2c4035908f076083..4547f53e24d812a9df965ed1bce291780fa6546e 100755 (executable)
@@ -51,6 +51,8 @@ assert_eq "$(systemd-path --suffix='' system-runtime)" "/run"
 assert_eq "$(systemd-path --suffix='🤔' system-runtime)" "/run/🤔"
 assert_eq "$(systemd-path --suffix=hello system-runtime)" "/run/hello"
 
+assert_eq "$(systemd-path system-search-configuration --suffix=sysctl.d)" "/etc/sysctl.d:/run/sysctl.d:/usr/local/lib/sysctl.d:/usr/lib/sysctl.d"
+
 # Note for the stuff below: everything defaults to $HOME, only the desktop
 # directory defaults to $HOME/Desktop.
 #