summaryrefslogtreecommitdiff
path: root/pkg/hunter
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2018-02-15 20:30:59 +0100
committerKali Kaneko <kali@leap.se>2018-02-15 22:55:49 +0100
commitbb00a1dfa75f1a9a0a9ff55afc0da3d6510ab613 (patch)
treeb3a03f46fbaa9ce338d0d25e60ddad3fdd1f91b2 /pkg/hunter
parentd798346948aff01051c59261f739cb720c18f0a6 (diff)
[pkg] life is better among hunter-gatherers
aka, get *all* of the dynamic libraries into the bundle. This probably won't work like this, but I think it's more comfortable to strip libraries from the list rather than hunting for them one by one.
Diffstat (limited to 'pkg/hunter')
-rwxr-xr-xpkg/hunter/gatherer36
1 files changed, 36 insertions, 0 deletions
diff --git a/pkg/hunter/gatherer b/pkg/hunter/gatherer
new file mode 100755
index 00000000..5412748e
--- /dev/null
+++ b/pkg/hunter/gatherer
@@ -0,0 +1,36 @@
+#!/bin/bash
+# Author : Hemanth.HM
+# Email : hemanth[dot]hm[at]gmail[dot]com
+# License : GNU GPLv3
+#
+
+function useage()
+{
+ cat << EOU
+Useage: bash $0 <path to the binary> <path to copy the dependencies>
+EOU
+exit 1
+}
+
+#Validate the inputs
+[[ $# < 2 ]] && useage
+
+#Check if the paths are vaild
+[[ ! -e $1 ]] && echo "Not a vaild input $1" && exit 1
+[[ -d $2 ]] || echo "No such directory $2 creating..."&& mkdir -p "$2"
+
+#Get the library dependencies
+echo "Collecting the shared library dependencies for $1..."
+deps=$(ldd $1 | awk 'BEGIN{ORS=" "}$1\
+~/^\//{print $1}$3~/^\//{print $3}'\
+ | sed 's/,$/\n/')
+echo "Copying the dependencies to $2"
+
+#Copy the deps
+for dep in $deps
+do
+ echo "Copying $dep to $2"
+ cp "$dep" "$2"
+done
+
+echo "Done!"