1 |
#!/bin/bash |
#!/bin/bash |
2 |
|
|
3 |
SOURCE="$1" |
SOURCE="$1" |
4 |
|
if [[ $2 = --references ]] || [[ $2 = -r ]] |
5 |
|
then |
6 |
|
shift;shift |
7 |
|
for i in $1 |
8 |
|
do |
9 |
|
REFERENCES="${REFERENCES} $(< ${i})" |
10 |
|
done |
11 |
|
fi |
12 |
|
|
13 |
|
COLRED="\033[1;6m\033[31m" |
14 |
|
COLDEFAULT="\033[0m" |
15 |
|
|
16 |
not_in_list() |
not_in_list() |
17 |
{ |
{ |
27 |
return 0 |
return 0 |
28 |
} |
} |
29 |
|
|
30 |
echo -n "resolving linking lib ... " |
echo -n "resolving linking libs ... " |
31 |
|
|
32 |
# first binaries: |
# first binaries: |
33 |
for bin in $(find ${SOURCE} | xargs file | grep "executable" | grep ELF | cut -f 1 -d :) \ |
for bin in $(find ${SOURCE} | xargs file | grep "executable" | grep ELF | cut -f 1 -d :) \ |
67 |
for i in ${ALL_DEPS} |
for i in ${ALL_DEPS} |
68 |
do |
do |
69 |
pkg=$(/sbin/magequery -f "${i}") |
pkg=$(/sbin/magequery -f "${i}") |
70 |
|
if [[ -z ${pkg} ]] |
71 |
|
then |
72 |
|
NO_PACKAGE_FOUND="${NO_PACKAGE_FOUND}:${i} -> no pkg found." |
73 |
|
continue |
74 |
|
fi |
75 |
for z in ${pkg} |
for z in ${pkg} |
76 |
do |
do |
77 |
if not_in_list "${ALL_PACKAGES}" "${z}" |
if not_in_list "${ALL_PACKAGES}" "${z}" |
86 |
echo |
echo |
87 |
for i in ${ALL_PACKAGES} |
for i in ${ALL_PACKAGES} |
88 |
do |
do |
89 |
echo "${i}" |
if not_in_list "${REFERENCES}" "${i}" |
90 |
|
then |
91 |
|
echo "${i}" |
92 |
|
else |
93 |
|
echo -e "${COLRED}${i}${COLDEFAULT}" |
94 |
|
fi |
95 |
done | sort |
done | sort |
96 |
echo |
echo |
97 |
|
|
98 |
|
if [[ ${PRINT_NOT_FOUND} = true ]] |
99 |
|
then |
100 |
|
echo |
101 |
|
echo "Non resolved libs:" |
102 |
|
OLDIFS="${IFS}" |
103 |
|
IFS=: |
104 |
|
for i in ${NO_PACKAGE_FOUND} |
105 |
|
do |
106 |
|
echo ${i} |
107 |
|
done | sort |
108 |
|
IFS="${OLDIFS}" |
109 |
|
echo |
110 |
|
fi |