From c529d427e1ae79a90ba47d0d579cbd3e034f4b03 Mon Sep 17 00:00:00 2001
From: fbailly <fbailly@laas.fr>
Date: Thu, 31 Jan 2019 15:01:54 +0100
Subject: [PATCH] Adding searchLib.sh, a script for sorting dependencies of
 librairies

---
 scripts/README.md    | 11 +++++++++++
 scripts/searchLib.sh | 24 ++++++++++++++++++++++++
 2 files changed, 35 insertions(+)
 create mode 100755 scripts/searchLib.sh

diff --git a/scripts/README.md b/scripts/README.md
index 96728e4..09091ab 100644
--- a/scripts/README.md
+++ b/scripts/README.md
@@ -65,3 +65,14 @@ The first allows to check that the camera is configured correctly.
 If you are not satisfied, you have to use the [web interface](http://axis-ptz1).
 
 The second records the current view. It is meant to be run in `eur0c:/local/axis`
+
+## `searchLib.sh`
+
+```
+usage: searchLib.sh my_lib version_to_avoid
+
+This script searches all the .so files in the current directory.
+The first arg is a string contained in the dependencies of the library you are looking for.
+The second arg is a string contained in the dependencies that you want to reject. 
+The script will display the names of the .so files which meet these criteria.
+```
diff --git a/scripts/searchLib.sh b/scripts/searchLib.sh
new file mode 100755
index 0000000..02d08b9
--- /dev/null
+++ b/scripts/searchLib.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+# This script searches all the .so files in the current directory.
+# The first arg is a string contained in the dependencies of the library you are looking for.
+# The second arg is a string contained in the dependencies that you want to reject. 
+# The script will display the names of the .so files which meet these criteria.
+# Ex: searchLib.sh my_lib version_to_avoid
+
+set +e
+w=`find . -name "*.so" -print`
+
+for v in $w
+do
+    #echo $v
+    out_v=`basename $v`.txt
+    #echo $out_v
+    ldd $v  > /tmp/$out_v
+    grep -nH $1 /tmp/$out_v | grep -v $2 &> /tmp/test
+    if [ -s /tmp/test ]
+    then
+	echo $v
+    fi
+done
+
-- 
GitLab