Magellan Linux

Contents of /trunk/mage/usr/lib/mage/autodepend.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2824 - (show annotations) (download) (as text)
Tue Sep 9 13:59:50 2014 UTC (9 years, 7 months ago) by niro
File MIME type: application/x-sh
File size: 1105 byte(s)
-whitespaces
1 #!/bin/bash
2 # $Id$
3
4 SCANELF="scanelf -LnyRB"
5 BINDIR="$1"
6
7 if [[ -z ${BINDIR} ]]
8 then
9 echo "No \$BINDIR given"
10 exit 1
11 fi
12
13 build_soname_list()
14 {
15 local sonames
16 local i
17 sonames="$(${SCANELF} ${BINDIR} | cut -d' ' -f2 | sed 's:,:\ :g')"
18
19 # now drop all duplicates
20 SONAME_LIST="$(for i in ${sonames}; do echo ${i}; done | sort -u)"
21 export SONAME_LIST
22 }
23
24 build_dep_list()
25 {
26 local soname
27 local libdir
28 local deps
29 local i
30 local prefix
31 local resolved
32
33 for soname in ${SONAME_LIST}
34 do
35 # if /lib /lib64 are symlinks than add a prefix to honor usr-move
36 libdir="${soname%/*}"
37 prefix=""
38 resolved=""
39 if [[ ${libdir} = /lib ]] || [[ ${libdir} = /lib64 ]]
40 then
41 if [[ -L /lib ]] || [[ -L /lib64 ]]
42 then
43 prefix="/usr"
44 fi
45 fi
46
47 resolved="$(magequery -e ${prefix}${soname})"
48 if [[ -z ${resolved} ]]
49 then
50 resolved="${prefix}/${soname}:_not_found"
51 fi
52 deps+=" ${resolved}"
53 done
54 DEPNAME_LIST="$(for i in ${deps}; do echo ${i}; done | sort -u)"
55 export DEPNAME_LIST
56 }
57
58 build_soname_list
59 build_dep_list
60
61 #echo "${SONAME_LIST}"
62 echo "${DEPNAME_LIST}" | sed 's:\(.*\)-r.*:>= \1:'

Properties

Name Value
svn:executable *