[PATCH] libtracecmd: Fix make install_libs updating of ldconfig

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Steven Rostedt (VMware)" <rostedt@xxxxxxxxxxx>

The ldconfig file /etc/ld.conf.d/trace.conf was being updated when it did
not need to be, and should not be updated if ldconfig is not in the patch
when installing.

Add a check to see if ldconfig can successfully run before testing if conf
file should be updated. Also fix the grep of the conf file that looks for
the path such that the output is not displayed to the console.

Signed-off-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx>
---
 lib/trace-cmd/Makefile | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/lib/trace-cmd/Makefile b/lib/trace-cmd/Makefile
index 9bba5a21..17600318 100644
--- a/lib/trace-cmd/Makefile
+++ b/lib/trace-cmd/Makefile
@@ -70,16 +70,18 @@ ifeq ("$(DESTDIR)", "")
 # and running ldconfig, if the library is visible by ld.so.
 # If not, add the path to /etc/ld.so.conf.d/trace.conf and run ldconfig again.
 define install_ld_config
-	$(LDCONFIG); \
-	if ! grep "^$(libdir)$$" $(LD_SO_CONF_PATH)/* &> /dev/null ; then \
-		$(CC) -o $(bdir)/test $(ldir)/test.c -I $(includedir_SQ) \
-			-L $(libdir_SQ) -ltracecmd > /dev/null; \
-		if ! $(bdir)/test &> /dev/null; then \
-			$(call print_install,trace.conf,$(LD_SO_CONF_PATH)) \
-			echo $(libdir_SQ) >> $(LD_SO_CONF_PATH)/trace.conf; \
-			$(LDCONFIG); \
+	if $(LDCONFIG); then \
+		if ! grep -q "^$(libdir)$$" $(LD_SO_CONF_PATH)/* ; then \
+			echo here;\
+			$(CC) -o $(bdir)/test $(ldir)/test.c -I $(includedir_SQ) \
+				-L $(libdir_SQ) -ltracecmd &> /dev/null; \
+			if ! $(bdir)/test &> /dev/null; then \
+				$(call print_install,trace.conf,$(LD_SO_CONF_PATH)) \
+				echo $(libdir_SQ) >> $(LD_SO_CONF_PATH)/trace.conf; \
+				$(LDCONFIG); \
+			fi; \
+			$(RM) $(bdir)/test; \
 		fi; \
-		$(RM) $(bdir)/test; \
 	fi
 endef
 else
-- 
2.29.2




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux