Magellan Linux

Contents of /trunk/mlivecdbuild/files/depwanderer.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 27 - (show annotations) (download) (as text)
Wed Jan 5 05:36:10 2005 UTC (19 years, 3 months ago) by niro
File MIME type: application/x-sh
File size: 2512 byte(s)
mlivecdbuild-0.3.6-r7 import

1 #!/bin/bash
2
3
4 #DEPEND WANDERER
5
6 MAGEFILE=$2
7 ALLDEPS=""
8
9
10 source /etc/mage.rc
11 source /etc/init.d/functions
12
13 #check_stable_package /path/to/foo.mage
14 # returns 0=stable 1=unstable
15 check_stable_package(){
16 #be sure no previous $STATES exists
17 unset STATE
18
19 source $1
20 if [ "$?" == "1" ]
21 then
22 TODESVAR=1
23 fi
24
25 if [ "${STATE}" != "stable" ]
26 then
27 return 1
28 fi
29
30 #unset the sourced varibales;
31 #we'll got bad problems later on if we don't do this
32 unset PKGNAME
33 unset STATE
34 unset DESCRIPTION
35 unset HOMEPAGE
36 unset DEPEND
37 unset preinstall
38 unset postinstall
39
40 return 0
41 }
42
43
44 #####################
45 ## rumwandern /path/to/mage/file/.mage
46 rumwandern(){
47
48 unset DEPEND
49 unset MY_DEPEND
50
51 local DFILE
52 local SYM
53 local DEPNAME
54 local HIGHEST_DEPFILE
55 local MY_DEPEND
56 DFILE=$1
57
58 source ${DFILE}
59 MY_DEPEND="${DEPEND}"
60 unset DEPEND
61
62 if [ -z "${MY_DEPEND}" ]
63 then
64 return 1
65 fi
66
67 while read SYM DEPNAME
68 do
69 CAT=$(echo ${DEPNAME}|cut -d / -f1)
70 PNAME=$(echo ${DEPNAME%-*}|cut -d / -f2)
71 #echo "DEBUG CAT=${CAT}"
72 #echo "DEBUG PNAME=${PNAME}"
73 #echo "DEBUG DEPNAME=${DEPNAME}"
74
75 for i in ${MAGEDIR}/${CAT}/${PNAME}/*.mage
76 do
77 #we exclude subdirs (for stuff like a md5sum dir)
78 if [ ! -d ${i} ]
79 then
80 check_stable_package ${i}
81 if [ "$?" == "0" ]
82 then
83 HIGHEST_DEPFILE=${i}
84 fi
85
86 #debug
87 if [ "${TODESVAR}" == 1 ]
88 then
89 echo -e ${COLRED}"${DFILE}"${COLDEFAULT}
90 unset TODESVAR
91 fi
92 fi
93 done
94
95 ##check ob schon in ALLDEPS enthalten dann mach weiter
96 local x
97 x=$(echo ${ALLDEPS}|fgrep "${HIGHEST_DEPFILE}")
98 if [ -z "${x}" ]
99 then
100 ### check ob DFILE schon installiert ist ###
101 if [ ! -d ${INSTALLDB}/$(basename ${HIGHEST_DEPFILE} .mage) ]
102 then
103 rumwandern ${HIGHEST_DEPFILE}
104 ALLDEPS="${ALLDEPS} ${HIGHEST_DEPFILE}"
105 fi
106 fi
107
108 done << EOF
109 $MY_DEPEND
110 EOF
111 return 0
112 }
113
114 ### check ob MAGEFILE schon installiert ist
115 if [ -d ${INSTALLDB}/$(basename ${MAGEFILE} .mage) ]
116 then
117 exit 3
118 fi
119
120 if [ $1 == pretend ]
121 then
122 echo -en "Calculating Dependencies ... "
123 fi
124
125 rumwandern ${MAGEFILE}
126
127 if [ $1 == pretend ]
128 then
129 echo "done"
130 fi
131
132 ##anhängen des zu installierenden files selber
133 ALLDEPS="${ALLDEPS} ${MAGEFILE}"
134
135
136 ##ausgabe pretend
137 if [ $1 == pretend ]
138 then
139 ####test ausgabe
140 declare -i x=0
141 for i in ${ALLDEPS}
142 do
143 x=$x+1
144 echo -en "\t${COLBLUE}["
145 if [ ${x} -le 9 ]
146 then
147 echo -en "0"
148 fi
149 echo -e "${x}] ${COLGREEN}$(basename ${i} .mage)"${COLDEFAULT}
150 done
151 fi
152
153 ##return ausgabe install
154 if [ $1 == install ]
155 then
156 echo ${ALLDEPS}
157 fi

Properties

Name Value
svn:executable *