From ead5f5235a5a713119b1b2543c699b08c50f65a7 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Mon, 18 May 2020 12:41:16 +0100
Subject: [PATCH] runtime: Look for ldconfig in /sbin, /usr/sbin

If we are on an OS where /sbin is not normally in unprivileged users'
PATHs (for example Debian), we won't find ldconfig in PATH and will
need to try harder.

Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 src/runtime.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/runtime.c b/src/runtime.c
index 0391abf21..6bb8d86e2 100644
--- a/src/runtime.c
+++ b/src/runtime.c
@@ -1701,9 +1701,17 @@ pv_runtime_use_host_graphics_stack (PvRuntime *self,
 
       ldconfig = g_find_program_in_path ("ldconfig");
 
+      if (ldconfig == NULL
+          && g_file_test ("/sbin/ldconfig", G_FILE_TEST_IS_EXECUTABLE))
+        ldconfig = g_strdup ("/sbin/ldconfig");
+
+      if (ldconfig == NULL
+          && g_file_test ("/usr/sbin/ldconfig", G_FILE_TEST_IS_EXECUTABLE))
+        ldconfig = g_strdup ("/usr/sbin/ldconfig");
+
       if (ldconfig == NULL)
         {
-          g_warning ("Cannot find ldconfig in PATH");
+          g_warning ("Cannot find ldconfig in PATH, /sbin or /usr/sbin");
         }
       else
         {
-- 
GitLab