]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
meson: read more progs from PATH
authornikstur <nikstur@outlook.com>
Tue, 10 Feb 2026 11:53:40 +0000 (12:53 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 16 Feb 2026 13:32:38 +0000 (14:32 +0100)
Find more progs on PATH instead of hardcoding them.

meson.build
src/journal/cat.c
src/nspawn/nspawn-setuid.c
src/shared/polkit-agent.c
units/ldconfig.service
units/modprobe@.service

index f562754c19bbd049f8026207ad6a441792ed0b64..ee96fcb21f7709f530cf67a14e6c5362a782f46e 100644 (file)
@@ -256,7 +256,6 @@ conf.set_quoted('KERNEL_INSTALL_DIR',                         kernelinstalldir)
 conf.set_quoted('MODPROBE_DIR',                               modprobedir)
 conf.set_quoted('MODULESLOAD_DIR',                            modulesloaddir)
 conf.set_quoted('PKGSYSCONFDIR',                              pkgsysconfdir)
-conf.set_quoted('POLKIT_AGENT_BINARY_PATH',                   bindir / 'pkttyagent')
 conf.set_quoted('POLKIT_RULES_DIR',                           polkitrulesdir)
 conf.set_quoted('PREFIX',                                     prefixdir)
 conf.set_quoted('PREFIX_NOSLASH',                             prefixdir_noslash)
index d1f4db80308552401d050535c1763861c84b0eba..76d36fce7e47731c9a6492f95ba57a0494c375a7 100644 (file)
@@ -158,7 +158,7 @@ static int run(int argc, char *argv[]) {
                 return log_error_errno(r, "Failed to rearrange stdout/stderr: %m");
 
         if (argc <= optind)
-                (void) execl("/bin/cat", "/bin/cat", NULL);
+                (void) execlp("cat", "cat", NULL);
         else {
                 struct stat st;
 
index 1c167ebc029ac23a02c44bdc6afe6606bc6f5da5..d2db37b4387c459ee59901437e2fcb3b3420ed34 100644 (file)
@@ -38,8 +38,7 @@ static int spawn_getent(const char *database, const char *key, PidRef *ret) {
                 return r;
         }
         if (r == 0) {
-                execle("/usr/bin/getent", "getent", database, key, NULL, &(char*[1]){});
-                execle("/bin/getent", "getent", database, key, NULL, &(char*[1]){});
+                execlp("getent", "getent", database, key, NULL);
                 _exit(EXIT_FAILURE);
         }
 
index 5b4e5db819e30d363febf4be5b5125a587b53404..0718c72ac437ded8e6716d4ddc2127157327ccd7 100644 (file)
@@ -3,11 +3,13 @@
 #include <poll.h>
 #include <unistd.h>
 
+#include "alloc-util.h"
 #include "bus-util.h"
 #include "exec-util.h"
 #include "fd-util.h"
 #include "io-util.h"
 #include "log.h"
+#include "path-util.h"
 #include "pidref.h"
 #include "polkit-agent.h"
 #include "stdio-util.h"
@@ -31,6 +33,15 @@ int polkit_agent_open(void) {
         if (r <= 0)
                 return r;
 
+        _cleanup_free_ char *pkttyagent = NULL;
+        r = find_executable("pkttyagent", &pkttyagent);
+        if (r == -ENOENT) {
+                log_debug("pkttyagent binary not available, ignoring.");
+                return 0;
+        }
+        if (r < 0)
+                return log_error_errno(r, "Failed to determine whether pkttyagent binary exists: %m");
+
         if (pipe2(pipe_fd, 0) < 0)
                 return -errno;
 
@@ -40,7 +51,7 @@ int polkit_agent_open(void) {
                        &pipe_fd[1],
                        1,
                        &agent_pidref,
-                       POLKIT_AGENT_BINARY_PATH,
+                       pkttyagent,
                        "--notify-fd", notify_fd,
                        "--fallback");
         if (r < 0)
index 404fa011d5a7347aaa7985041b73542b45ab8154..8199416b16242d957ee8e1766f68cf6d947ac2cf 100644 (file)
@@ -25,4 +25,4 @@ Before=shutdown.target initrd-switch-root.target
 [Service]
 Type=oneshot
 RemainAfterExit=yes
-ExecStart=/sbin/ldconfig -X
+ExecStart=ldconfig -X
index b099b90ebaba33d813aad3b915e48354afd2e66a..58b911d0a3a683194c1d100fd8175ad00c609f0d 100644 (file)
@@ -32,4 +32,4 @@ StartLimitIntervalSec=0
 
 [Service]
 Type=oneshot
-ExecStart=-/sbin/modprobe -abq %i
+ExecStart=-modprobe -abq %i