-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdepends
More file actions
executable file
·36 lines (29 loc) · 811 Bytes
/
Copy pathdepends
File metadata and controls
executable file
·36 lines (29 loc) · 811 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#/bin/bash
name=$(basename $(pwd))
binary=build/src/$name.so
if [ ! -f $binary ]
then
echo "error: missing binary (did you forget to build?)"
exit 1
fi
# Check missing libraries
missing=$(ldd $binary | grep 'not found')
if [ ! -z "$missing" ]
then
echo "error: missing libraries"
echo $missing | sed 's/ => not found//'
exit 1
fi
# List libraries
libs=$(ldd $binary | sed -r -e 's_.*=> ([^ ]*) .*_\1_' -e 's_[\t ]*(/[^ ]*) .*_\1_')
# List corresponding packages
if [ -x "$(which dpkg 2>/dev/null)" ]
then
packages="$(dpkg -S $libs 2>/dev/null | cut -f 1 -d : | sort | uniq)"
elif [ -x "$(which rpm 2>/dev/null)" ]
then
packages="$(rpm -qf $libs 2>/dev/null | cut -f 1 -d : | sort | uniq)"
fi
# Format package list for checkinstall CLI
packages=$(echo -e $packages | sed 's/ /, /g')
echo $packages