1 |
#!/bin/bash |
#!/bin/bash |
2 |
|
|
3 |
#depwalker |
#depwalker |
4 |
# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/depwalker.sh,v 1.5 2007-01-22 00:24:14 niro Exp $ |
# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/depwalker.sh,v 1.6 2007-11-05 16:49:33 niro Exp $ |
5 |
|
|
6 |
# default die function |
# default die function |
7 |
die() |
die() |
92 |
ALLDEPS="" |
ALLDEPS="" |
93 |
MAGEFILE="${MAGEDIR}/${PCAT}/${PNAME}/${PNAME}-${PVER}-${PBUILD}.mage" |
MAGEFILE="${MAGEDIR}/${PCAT}/${PNAME}/${PNAME}-${PVER}-${PBUILD}.mage" |
94 |
|
|
95 |
|
# much faster than fgrep |
96 |
|
checklist_alldeps() |
97 |
|
{ |
98 |
|
local i |
99 |
|
local item="$1" |
100 |
|
|
101 |
|
for i in ${ALLDEPS} |
102 |
|
do |
103 |
|
[[ ${i} = ${item} ]] && return 1 |
104 |
|
done |
105 |
|
|
106 |
|
return 0 |
107 |
|
} |
108 |
|
|
109 |
##################### |
##################### |
110 |
## rumwandern /path/to/mage/file/.mage |
## rumwandern /path/to/mage/file/.mage |
111 |
rumwandern() |
rumwandern() |
170 |
PBUILD="$(magename2pbuild ${HIGHEST_DEPFILE})" |
PBUILD="$(magename2pbuild ${HIGHEST_DEPFILE})" |
171 |
|
|
172 |
## check ob schon in ALLDEPS enthalten dann mach weiter |
## check ob schon in ALLDEPS enthalten dann mach weiter |
173 |
if [ -z "$(echo ${ALLDEPS} | fgrep "${HIGHEST_DEPFILE}")" ] |
|
174 |
|
# usage of fgrep is extremly slow and consumes a lot of cpu power |
175 |
|
#if [ -z "$(echo ${ALLDEPS} | fgrep "${HIGHEST_DEPFILE}")" ] |
176 |
|
if checklist_alldeps "${HIGHEST_DEPFILE}" |
177 |
then |
then |
178 |
### check ob DFILE schon installiert ist ### |
### check ob DFILE schon installiert ist ### |
179 |
if [ ! -d ${MROOT}${INSTALLDB}/${PCAT}/${PNAME}-${PVER}-${PBUILD} ] |
if [ ! -d ${MROOT}${INSTALLDB}/${PCAT}/${PNAME}-${PVER}-${PBUILD} ] |
226 |
|
|
227 |
# now add the package itself to the dependencies |
# now add the package itself to the dependencies |
228 |
# (if not exists already) |
# (if not exists already) |
229 |
if [ -z "$(echo ${ALLDEPS} | fgrep "${MAGEFILE}")" ] |
#if [ -z "$(echo ${ALLDEPS} | fgrep "${MAGEFILE}")" ] |
230 |
|
if checklist_alldeps "${MAGEFILE}" |
231 |
then |
then |
232 |
ALLDEPS="${ALLDEPS} ${MAGEFILE}" |
ALLDEPS="${ALLDEPS} ${MAGEFILE}" |
233 |
fi |
fi |