1 |
#!/bin/bash |
#!/bin/bash |
2 |
|
# $Id$ |
3 |
#depwalker |
# dependeny walker |
|
# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/depwalker.sh,v 1.10 2008-03-26 15:58:25 niro Exp $ |
|
4 |
|
|
5 |
# default die function |
# default die function |
6 |
die() |
die() |
21 |
source ${MLIBDIR}/mage4.functions.sh || \ |
source ${MLIBDIR}/mage4.functions.sh || \ |
22 |
die "mage functions missing" |
die "mage functions missing" |
23 |
|
|
|
# for tests only |
|
|
# source /home/tjoke/alx-cvs/magellan-src/mage/usr/lib/mage/mage.rc.global |
|
|
# source /etc/mage.rc |
|
|
# source /home/tjoke/alx-cvs/magellan-src/mage/usr/lib/mage/mage4.functions.sh |
|
|
# MLIBDIR=/home/tjoke/alx-cvs/magellan-src/mage/usr/lib/mage |
|
|
|
|
|
# not serious if missing, only needed for colors |
|
|
[ -f /etc/init.d/functions ] && source /etc/init.d/functions |
|
|
|
|
|
# disable colors if wanted |
|
|
if [[ ${NOCOLORS} = true ]] |
|
|
then |
|
|
COLRED="" |
|
|
COLGREEN="" |
|
|
COLYELLOW="" |
|
|
COLBLUE="" |
|
|
COLMAGENTA="" |
|
|
COLWHITE="" |
|
|
COLDEFAULT="" |
|
|
fi |
|
|
|
|
24 |
usage() |
usage() |
25 |
{ |
{ |
26 |
echo |
echo |
98 |
} |
} |
99 |
|
|
100 |
##################### |
##################### |
101 |
## rumwandern /path/to/mage/file/.mage |
## depwalking /path/to/mage/file/.mage |
102 |
rumwandern() |
depwalking() |
103 |
{ |
{ |
104 |
unset DEPEND |
unset DEPEND |
105 |
unset SDEPEND |
unset SDEPEND |
121 |
DFILE="$1" |
DFILE="$1" |
122 |
|
|
123 |
source ${DFILE} |
source ${DFILE} |
124 |
|
|
125 |
|
# forced nodeps |
126 |
|
if [[ ${NODEPS} = true ]] |
127 |
|
then |
128 |
|
DEPEND="" |
129 |
|
SDEPEND="" |
130 |
|
fi |
131 |
|
|
132 |
MY_DEPEND="${DEPEND}" |
MY_DEPEND="${DEPEND}" |
133 |
|
|
134 |
# for srcinstall & srcdepend only; SDEPEND also needed |
# for srcinstall & srcdepend only; SDEPEND also needed |
185 |
PVER="$(magename2pver ${HIGHEST_DEPFILE})" |
PVER="$(magename2pver ${HIGHEST_DEPFILE})" |
186 |
PBUILD="$(magename2pbuild ${HIGHEST_DEPFILE})" |
PBUILD="$(magename2pbuild ${HIGHEST_DEPFILE})" |
187 |
|
|
188 |
## check ob schon in ALLDEPS enthalten dann mach weiter |
## dep already in ALLDEPS? then going on |
189 |
|
|
190 |
# usage of fgrep is extremly slow and consumes a lot of cpu power |
# usage of fgrep is extremly slow and consumes a lot of cpu power |
191 |
#if [ -z "$(echo ${ALLDEPS} | fgrep "${HIGHEST_DEPFILE}")" ] |
#if [ -z "$(echo ${ALLDEPS} | fgrep "${HIGHEST_DEPFILE}")" ] |
194 |
### check ob DFILE schon installiert ist ### |
### check ob DFILE schon installiert ist ### |
195 |
if [ ! -d ${MROOT}${INSTALLDB}/${PCAT}/${PNAME}-${PVER}-${PBUILD} ] |
if [ ! -d ${MROOT}${INSTALLDB}/${PCAT}/${PNAME}-${PVER}-${PBUILD} ] |
196 |
then |
then |
197 |
rumwandern ${HIGHEST_DEPFILE} |
depwalking ${HIGHEST_DEPFILE} |
198 |
ALLDEPS="${ALLDEPS} ${HIGHEST_DEPFILE}" |
ALLDEPS="${ALLDEPS} ${HIGHEST_DEPFILE}" |
199 |
fi |
fi |
200 |
fi |
fi |
204 |
return 0 |
return 0 |
205 |
} |
} |
206 |
|
|
|
|
|
|
### abort if this package is already installed (retval 3) |
|
|
# maybe later ? |
|
|
#[ -d ${INSTALLDB}/${PCAT}/${PNAME}-${PVER}-${PBUILD} ] && exit 3 |
|
|
|
|
207 |
[[ ${METHOD} = pretend ]] || \ |
[[ ${METHOD} = pretend ]] || \ |
208 |
[[ ${METHOD} = srcpretend ]] || \ |
[[ ${METHOD} = srcpretend ]] || \ |
209 |
[[ ${METHOD} = uppretend ]] || \ |
[[ ${METHOD} = uppretend ]] || \ |
237 |
PVER="$(magename2pver ${MAGEFILE})" |
PVER="$(magename2pver ${MAGEFILE})" |
238 |
PBUILD="$(magename2pbuild ${MAGEFILE})" |
PBUILD="$(magename2pbuild ${MAGEFILE})" |
239 |
|
|
240 |
# do not wander files which are installed |
# do not walk files which are installed |
241 |
if [ ! -d ${INSTALLDB}/${PCAT}/${PNAME}-${PVER}-${PBUILD} ] |
if [ ! -d ${INSTALLDB}/${PCAT}/${PNAME}-${PVER}-${PBUILD} ] |
242 |
then |
then |
243 |
# get dependencies the package |
# get dependencies the package |
244 |
rumwandern ${MAGEFILE} |
depwalking ${MAGEFILE} |
245 |
|
|
246 |
# now add the package itself to the dependencies |
# now add the package itself to the dependencies |
247 |
# (if not exists already) |
# (if not exists already) |
253 |
fi |
fi |
254 |
done |
done |
255 |
else |
else |
256 |
# get dependencies the package |
# get all dependencies of the package |
257 |
rumwandern ${MAGEFILE} |
depwalking ${MAGEFILE} |
258 |
|
|
259 |
# now add the package itself to the dependencies |
# now add the package itself to the dependencies |
260 |
ALLDEPS="${ALLDEPS} ${MAGEFILE}" |
ALLDEPS="${ALLDEPS} ${MAGEFILE}" |
309 |
echo |
echo |
310 |
echo -e "${COLRED}Please consider to uninstall all of them first,${COLDEFAULT}" |
echo -e "${COLRED}Please consider to uninstall all of them first,${COLDEFAULT}" |
311 |
echo -e "${COLRED}because these packages does not exist in this distribution${COLDEFAULT}" |
echo -e "${COLRED}because these packages does not exist in this distribution${COLDEFAULT}" |
312 |
echo -e "${COLRED}and there will be no further updates or support for them.${COLDEFAULT}" |
echo -e "${COLRED}anymore and there will be no further support for them.${COLDEFAULT}" |
313 |
echo |
echo |
314 |
fi |
fi |
315 |
fi |
fi |
320 |
[[ ${METHOD} = upgrade ]] || \ |
[[ ${METHOD} = upgrade ]] || \ |
321 |
[[ ${METHOD} = srcupgrade ]] && \ |
[[ ${METHOD} = srcupgrade ]] && \ |
322 |
echo "${ALLDEPS}" |
echo "${ALLDEPS}" |
|
|
|
|
# delete ${BUILDDIR}/virtuals if exists as not needed anymore |
|
|
#[ -d ${BUILDDIR}/virtuals ] && rm -rf ${BUILDDIR}/virtuals |
|