Magellan Linux

Contents of /trunk/depend-tools/discover_libs.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 359 - (show annotations) (download) (as text)
Mon Mar 27 21:21:04 2006 UTC (18 years, 1 month ago) by niro
File MIME type: application/x-sh
File size: 1518 byte(s)
show non resolved libs if wanted

1 #!/bin/bash
2
3 SOURCE="$1"
4
5 not_in_list()
6 {
7 local deplist="$1"
8 local dep="$2"
9 local i
10
11 for i in ${deplist}
12 do
13 [[ ${i} = ${dep} ]] && return 1
14 done
15
16 return 0
17 }
18
19 echo -n "resolving linking lib ... "
20
21 # first binaries:
22 for bin in $(find ${SOURCE} | xargs file | grep "executable" | grep ELF | cut -f 1 -d :) \
23 $(find ${SOURCE} | xargs file | grep "shared object" | grep ELF | cut -f 1 -d :)
24 do
25 while read lib
26 do
27 dep=$(echo "${lib}" | cut -d'>' -f2 | cut -d'(' -f1 | sed "s:\ ::g")
28 if [[ ${X11HACK} = true ]]
29 then
30 dep=$(echo ${dep} | sed "s:/usr/X11R6/:/usr/:g")
31 fi
32 if [[ -z $(echo ${dep} | grep "notfound") ]]
33 then
34 if not_in_list "${ALL_DEPS}" "${dep}"
35 then
36 ALL_DEPS="${ALL_DEPS} ${dep}"
37 fi
38 fi
39 done << EOF
40 $(ldd ${bin})
41 EOF
42 done
43 echo "done"
44
45 if [[ ${DEBUG} = true ]]
46 then
47 echo
48 for i in $(echo ${ALL_DEPS} | sort )
49 do
50 echo ${i}
51 done
52 echo
53 fi
54
55 echo -n "resolving packages ... "
56 for i in ${ALL_DEPS}
57 do
58 pkg=$(/sbin/magequery -f "${i}")
59 if [[ -z ${pkg} ]]
60 then
61 NO_PACKAGE_FOUND="${NO_PACKAGE_FOUND}:${i} -> no pkg found."
62 continue
63 fi
64 for z in ${pkg}
65 do
66 if not_in_list "${ALL_PACKAGES}" "${z}"
67 then
68 ALL_PACKAGES="${ALL_PACKAGES} ${z}"
69 [[ ${DEBUG} = true ]] && echo "DEBUG: ${z} ${i}"
70 fi
71 done
72 done
73 echo "done"
74
75 echo
76 for i in ${ALL_PACKAGES}
77 do
78 echo "${i}"
79 done | sort
80 echo
81
82 if [[ ${PRINT_NOT_FOUND} = true ]]
83 then
84 echo
85 echo "Non resolved libs:"
86 OLDIFS="${IFS}"
87 IFS=:
88 for i in ${NO_PACKAGE_FOUND}
89 do
90 echo ${i}
91 done | sort
92 IFS="${OLDIFS}"
93 echo
94 fi