Annotation of /trunk/mage/usr/lib/mage/mage3.sh
Parent Directory | Revision Log
Revision 169 -
(hide annotations)
(download)
(as text)
Sun Jul 31 11:57:05 2005 UTC (18 years, 9 months ago) by niro
File MIME type: application/x-sh
File size: 14755 byte(s)
Sun Jul 31 11:57:05 2005 UTC (18 years, 9 months ago) by niro
File MIME type: application/x-sh
File size: 14755 byte(s)
fixed locale issue; pkgs get not build or installed if the default system local ist another than LC_ALL=C
1 | niro | 24 | #!/bin/sh |
2 | # Magellan Linux Installer (mage.sh) | ||
3 | niro | 169 | # $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/mage3.sh,v 1.16 2005-07-31 11:56:45 niro Exp $ |
4 | niro | 24 | |
5 | ##configuration -> mage.rc | ||
6 | #PKGDIR="/usr/src/packages" | ||
7 | PKGSUFFIX="mpk" | ||
8 | #BUILDDIR="/usr/src" | ||
9 | #INSTALLDB="/var/ALXInstDB" | ||
10 | #MAGEDIR="/usr/src/mage-0.2" | ||
11 | MAGENAME="$2" | ||
12 | #PKGNAME="`basename $2 .mage`" | ||
13 | MLIBDIR=/usr/lib/mage | ||
14 | niro | 167 | MAGEVERSION=0.3.6-r19 |
15 | niro | 24 | |
16 | ## nur für tests -> normalerweise in /etc/rc.d/init.d/functions | ||
17 | COLRED="\033[1;6m\033[31m" | ||
18 | COLGREEN="\033[1;6m\033[32m" | ||
19 | COLBLUE="\033[1;6m\033[34m" | ||
20 | COLDEFAULT="\033[0m" | ||
21 | |||
22 | niro | 44 | # default path |
23 | PATH="${PATH}:${MLIBDIR}" | ||
24 | niro | 24 | |
25 | niro | 169 | # export the default C locale |
26 | export LC_ALL=C | ||
27 | |||
28 | niro | 24 | ##functions |
29 | if [ -f /etc/mage.rc ] | ||
30 | then | ||
31 | source /etc/mage.rc | ||
32 | else | ||
33 | echo "Your /etc/mage.rc is missing. Aborting." | ||
34 | exit 1 | ||
35 | fi | ||
36 | |||
37 | #virtualdb locations | ||
38 | VIRTUALDB_DEFAULTS=/etc/mage-profile/virtuals.defaults | ||
39 | VIRTUALDB_FILE=${INSTALLDB}/virtuals | ||
40 | |||
41 | #fix small problems | ||
42 | [ ! -e ${VIRTUALDB_FILE} ] && touch ${VIRTUALDB_FILE} | ||
43 | |||
44 | if [ ! -e ${VIRTUALDB_DEFAULTS} -a "$1" != "update" ] | ||
45 | then | ||
46 | echo | ||
47 | echo "Please choose an profile from the mage tree." | ||
48 | echo "ln -snf ${MAGEDIR}/profiles/profilename /etc/mage-profile" | ||
49 | exit 1 | ||
50 | fi | ||
51 | |||
52 | |||
53 | #loads functions | ||
54 | source ${MLIBDIR}/mage3.functions.sh | ||
55 | |||
56 | #############DIALOGE############## | ||
57 | showversion() { | ||
58 | echo -en "Magellan Package Manager v${MAGEVERSION} " | ||
59 | echo -e "-- Niels Rogalla (niro@magellan-linux.de)" | ||
60 | } | ||
61 | |||
62 | print_usage(){ | ||
63 | showversion | ||
64 | echo -e "\nUsage: (basename $0) [option] pkgname ..." | ||
65 | echo "Options:" | ||
66 | echo -e "\tpretend - pretends dependencies of a package" | ||
67 | echo -e "\tsrcpretend - pretends dependencies of a package (build from source)" | ||
68 | echo -e "\tinstall - installs a package" | ||
69 | echo -e "\tsrcinstall - installs a package from source" | ||
70 | echo -e "\tuninstall - removes a package" | ||
71 | echo -e "\tupdate - updates mage-tree" | ||
72 | echo -e "\tsearch - searches mage-tree for a package" | ||
73 | echo -e "\tclean - removes *all* downloaded packages" | ||
74 | echo -e "\tunpack - unpacks a package" | ||
75 | echo -e "\tdownload - downloads a package" | ||
76 | echo -e "\tkeepfiles - prevents files from uninstalling" | ||
77 | echo -e "\tinject - inject a package to fake dependencies" | ||
78 | echo -e "\treminjected - removes *all* fake packages" | ||
79 | echo -e "\tversion - prints version info" | ||
80 | echo | ||
81 | echo -e "Other:" | ||
82 | echo -e "NOINSTALL=yes $(basename $0) srcinstall PACKAGE" | ||
83 | echo -e "Builds a Package with its dependencies, but won't install anything." | ||
84 | echo | ||
85 | echo -e "BOOTSTRAP=yes $(basename $0) srcinstall PACKAGE" | ||
86 | echo -e "Force an bootstrap build for a Package." | ||
87 | echo -e "Works only for packages wich take use of that (like glibc and binutils)," | ||
88 | echo -e "by any other this feature will simple be ignored." | ||
89 | echo | ||
90 | echo -e "USE_UNSTABLE=true $(basename $0) [src]install PACKAGE" | ||
91 | echo -e "Overrides stable packages; you can install packages that are marked unstable." | ||
92 | echo | ||
93 | } | ||
94 | |||
95 | run_etc_update() { | ||
96 | if [ ${PROTECT_COUNT} -eq 0 ] | ||
97 | then | ||
98 | return 0 | ||
99 | fi | ||
100 | |||
101 | echo | ||
102 | echo "Important:" | ||
103 | echo "${PROTECT_COUNT} protected file(s) were installed." | ||
104 | echo | ||
105 | echo "Please run 'etc-update' to update your configuration files." | ||
106 | echo | ||
107 | } | ||
108 | |||
109 | mage_install_virtual(){ | ||
110 | echo -e "\nInstallation of Package: ${COLGREEN}$PKGNAME${COLDEFAULT}\n" | ||
111 | |||
112 | export -f preinstall 2> /dev/null | ||
113 | if [ "$?" == "0" ] | ||
114 | then | ||
115 | echo -e "\nRunning Preinstall ... \n" | ||
116 | preinstall | ||
117 | unset preinstall | ||
118 | fi | ||
119 | |||
120 | #creates fake db entry | ||
121 | install_database_entry ${PKGNAME} ${PKGTYPE} | ||
122 | |||
123 | export -f postinstall 2> /dev/null | ||
124 | if [ "$?" == "0" ] | ||
125 | then | ||
126 | echo -e "\nRunning Postinstall ... \n" | ||
127 | postinstall | ||
128 | unset postinstall | ||
129 | fi | ||
130 | |||
131 | #check for virtuals and PROVIDE | ||
132 | # if so install it to virtualdb | ||
133 | register_virtual_pkg | ||
134 | |||
135 | ${MLIBDIR}/env-rebuild.sh | ||
136 | echo -e "\nPackage '${PKGNAME/-${ARCH}/}' sucessfully installed.\n" | ||
137 | |||
138 | #unsets virtual state of packages | ||
139 | unset PKGTYPE | ||
140 | return 0 | ||
141 | } | ||
142 | |||
143 | |||
144 | register_virtual_pkg(){ | ||
145 | #first check if this pkg is an virtual_pkg | ||
146 | #echo "DEB: PKGNAME=${PKGNAME}" | ||
147 | |||
148 | if [ -e ${BUILDDIR}/virtuals/virtuals.${PKGNAME/-${ARCH}/} ] | ||
149 | then | ||
150 | #add it | ||
151 | source ${BUILDDIR}/virtuals/virtuals.${PKGNAME/-${ARCH}/} | ||
152 | virtuals_add ${DB_VIRTUAL_NAME} ${DB_PKG_NAME} | ||
153 | |||
154 | #than clean up | ||
155 | unset DB_VIRTUAL_NAME DB_PKG_NAME | ||
156 | rm ${BUILDDIR}/virtuals/virtuals.${PKGNAME/-${ARCH}/} | ||
157 | fi | ||
158 | niro | 157 | |
159 | niro | 24 | if [ -n "${PROVIDE}" ] |
160 | then | ||
161 | niro | 157 | # wander through all provides |
162 | local my_provides | ||
163 | for my_provides in ${PROVIDE} | ||
164 | do | ||
165 | local my_pgk | ||
166 | #cut arch | ||
167 | my_pkg=${PKGNAME/-${ARCH}/} | ||
168 | #cut version & build | ||
169 | my_pkg=${my_pkg%-*-*} | ||
170 | |||
171 | virtuals_add ${my_provides} ${CATEGORIE}/${my_pkg} | ||
172 | done | ||
173 | niro | 24 | unset PROVIDE |
174 | niro | 157 | unset my_provides |
175 | niro | 24 | fi |
176 | } | ||
177 | |||
178 | unregister_virtual_pkg(){ | ||
179 | if [ -n "${PROVIDE}" ] | ||
180 | then | ||
181 | local my_pgk | ||
182 | niro | 30 | local my_cat |
183 | local directory | ||
184 | local x | ||
185 | |||
186 | niro | 24 | #cut arch |
187 | my_pkg=${PKGNAME/-${ARCH}/} | ||
188 | niro | 30 | |
189 | niro | 24 | #cut version & build |
190 | my_pkg=${my_pkg%-*-*} | ||
191 | niro | 30 | my_cat=$(dirname ${my_pkg}) |
192 | |||
193 | #check if this was the last one or if any other exists | ||
194 | for directory in ${INSTALLDB}/${my_cat}/* | ||
195 | do | ||
196 | # continue if not a directory, | ||
197 | # or the same PNAME-PVER-PBUILD | ||
198 | niro | 157 | if [ ! -d "${directory}" ] |
199 | niro | 30 | then |
200 | continue | ||
201 | fi | ||
202 | |||
203 | #check if $directory is the same as $my_pkg | ||
204 | x=$(basename ${directory}) | ||
205 | if [[ ${my_cat}/${x%-*-*} = ${my_pkg} ]] | ||
206 | then | ||
207 | # break here | ||
208 | echo "==== another version of ${my_pkg} exists, not deleting ${VIRTUAL_NAME} ..." | ||
209 | return 0 | ||
210 | fi | ||
211 | done | ||
212 | |||
213 | niro | 24 | #virtuals_del ${PROVIDE} ${CATEGORIE}/${my_pkg} |
214 | niro | 157 | |
215 | # wander through all provides | ||
216 | local my_provides | ||
217 | for my_provides in ${PROVIDE} | ||
218 | do | ||
219 | #my_pkg has already the categorie -> ex my_pkg=x11-base/xfree | ||
220 | virtuals_del ${my_provides} ${my_pkg} | ||
221 | done | ||
222 | |||
223 | niro | 24 | unset PROVIDE |
224 | niro | 157 | unset my_provides |
225 | niro | 24 | fi |
226 | } | ||
227 | |||
228 | mage_install_sources() { | ||
229 | |||
230 | #creates fake db entry | ||
231 | install_database_entry ${PKGNAME} ${PKGTYPE} | ||
232 | |||
233 | #check for virtuals and PROVIDE | ||
234 | # if so install it to virtualdb | ||
235 | register_virtual_pkg | ||
236 | |||
237 | echo | ||
238 | echo -e "This Package is a Source Package." | ||
239 | echo | ||
240 | echo -e "Only 'srcinstall' works with this type of packages" | ||
241 | echo -en "If you have done a srcinstall before, " | ||
242 | echo -e "you will find the files in /usr/src." | ||
243 | echo | ||
244 | |||
245 | #nice timer (4 seconds) | ||
246 | # local x | ||
247 | # declare -i x=4 | ||
248 | # echo -en "Continues in 4s ..." | ||
249 | # while [ ${x} -gt 0 ] | ||
250 | # do | ||
251 | # i=${x}+1 | ||
252 | # echo -en "\b\b\b\b\b\b${x}s ..." | ||
253 | # #beeper | ||
254 | # echo -en "\a" | ||
255 | # sleep 1 | ||
256 | # done | ||
257 | # echo | ||
258 | |||
259 | sleep 1 | ||
260 | xtitleclean | ||
261 | } | ||
262 | |||
263 | mage_install() { | ||
264 | local MAGEFILE | ||
265 | local PKGTARBALL | ||
266 | |||
267 | MAGEFILE=$1 | ||
268 | |||
269 | source ${MAGEFILE} | ||
270 | |||
271 | #abbruch wenn schon installiert | ||
272 | if [ -e ${INSTALLDB}/${PKGNAME/-${ARCH}/} ] | ||
273 | then | ||
274 | echo -en "\n${COLRED}Package '${PKGNAME/-${ARCH}/}'" \ | ||
275 | echo -e "already installed. Installation Aborted.${COLDEFAULT}\n" | ||
276 | exit 3 | ||
277 | fi | ||
278 | |||
279 | xtitle "[ Installing ${PKGNAME/-${ARCH}/} ]" | ||
280 | |||
281 | if [ "${PKGTYPE}" == "virtual" ] | ||
282 | then | ||
283 | mage_install_virtual | ||
284 | return 0 | ||
285 | fi | ||
286 | |||
287 | if [ "${PKGTYPE}" == "sources" ] | ||
288 | then | ||
289 | mage_install_sources | ||
290 | return 0 | ||
291 | fi | ||
292 | |||
293 | if [ ! -e ${PKGDIR}/${PKGNAME}.${PKGSUFFIX} ] | ||
294 | then | ||
295 | echo -en "\nPrefetching needed Packages for " | ||
296 | echo -e "${COLGREEN}${PKGNAME/-${ARCH}/}${COLDEFAULT}...\n" | ||
297 | getpackages | ||
298 | fi | ||
299 | |||
300 | echo -e "\nInstallation of Package: ${COLGREEN}${PKGNAME/-${ARCH}/}${COLDEFAULT}\n" | ||
301 | #( build_unpackpkg ) | echo -e "Unpacking Package ...\n" | ||
302 | |||
303 | echo -en "Unpacking Package ..." | ||
304 | build_unpackpkg | ||
305 | echo "done" | ||
306 | |||
307 | ##preinstall scripte | ||
308 | export -f preinstall 2> /dev/null | ||
309 | if [ "$?" == "0" ] | ||
310 | then | ||
311 | echo -e "\nRunning Preinstall ... \n" | ||
312 | preinstall | ||
313 | unset preinstall | ||
314 | fi | ||
315 | |||
316 | #install of package | ||
317 | if [ "$VERBOSE" == "off" ] | ||
318 | then | ||
319 | #spinner disabled | ||
320 | #touch /var/tmp/proz | ||
321 | #build_doinstall|spin_processbar | ||
322 | |||
323 | echo -en "Processing ... " | ||
324 | build_doinstall ${PKGNAME} | ||
325 | echo "done" | ||
326 | fi | ||
327 | |||
328 | if [ "$VERBOSE" == "on" ] | ||
329 | then | ||
330 | #build_doinstall | ||
331 | build_doinstall ${PKGNAME} | ||
332 | fi | ||
333 | |||
334 | #postinstall scripte | ||
335 | export -f postinstall 2> /dev/null | ||
336 | if [ "$?" == "0" ] | ||
337 | then | ||
338 | echo -e "\nRunning Postinstall ... \n" | ||
339 | postinstall | ||
340 | unset postinstall | ||
341 | fi | ||
342 | |||
343 | #install database entry | ||
344 | install_database_entry ${PKGNAME} | ||
345 | |||
346 | #cleanup | ||
347 | if [ -d ${BUILDDIR}/${PKGNAME} ] | ||
348 | then | ||
349 | rm -rf ${BUILDDIR}/${PKGNAME} | ||
350 | fi | ||
351 | |||
352 | |||
353 | #check for virtuals and PROVIDE | ||
354 | # if so install it to virtualdb | ||
355 | register_virtual_pkg | ||
356 | |||
357 | |||
358 | #update mtimes of packages and db_entries | ||
359 | update_mtime | ||
360 | |||
361 | #rebuilds toplevel info node | ||
362 | echo -en "\n>>>> Rebuilding top-level info node ... " | ||
363 | ${MLIBDIR}/mkinfodir /usr/share/info > /usr/share/info/dir \ | ||
364 | && echo "done" || echo "false" | ||
365 | |||
366 | #rebuilds the enviroment with the content of /etc/env.d | ||
367 | ${MLIBDIR}/env-rebuild.sh | ||
368 | |||
369 | xtitleclean | ||
370 | |||
371 | echo -e "\nPackage '${PKGNAME/-${ARCH}/}' sucessfully installed.\n" | ||
372 | } | ||
373 | |||
374 | mage_uninstall() { | ||
375 | # #installdbhome #packagedir #magefile | ||
376 | #source ${INSTALLDB}/$(basename ${MAGENAME} .mage)/$(basename ${MAGENAME}) | ||
377 | #source ${INSTALLDB}/${CATEGORIE}/$(basename ${MAGENAME} .mage)/$(basename ${MAGENAME}) | ||
378 | |||
379 | local UNINST_MAGEFILE CAT_PKGNAME | ||
380 | |||
381 | CAT_PKGNAME=$1 | ||
382 | |||
383 | #trim pkgname from CAT_PKGNAME to get magefile name | ||
384 | UNINST_MAGEFILE="$(echo ${CAT_PKGNAME}| cut -d / -f2).mage" | ||
385 | |||
386 | #then source it | ||
387 | source ${INSTALLDB}/${CAT_PKGNAME}/${UNINST_MAGEFILE} | ||
388 | |||
389 | #fix for mage-0.3.6-r5 | ||
390 | #PKGNAME=${PKGNAME/-${ARCH}/} | ||
391 | PKGNAME=${CAT_PKGNAME} | ||
392 | |||
393 | #if [ ! -e ${INSTALLDB}/${PKGNAME/-${ARCH}/} ] | ||
394 | if [ ! -e ${INSTALLDB}/${CAT_PKGNAME} ] | ||
395 | then | ||
396 | echo -e "\nPackage '${PKGNAME}' is not installed. Uninstallation Aborted.\n" | ||
397 | exit 3 | ||
398 | fi | ||
399 | |||
400 | echo -e "\nUninstall of Package:\t${COLRED}${PKGNAME}${COLDEFAULT}\n" | ||
401 | |||
402 | if [ -z "${MAGE_UNINSTALL_TIMEOUT}" ] | ||
403 | then | ||
404 | MAGE_UNINSTALL_TIMEOUT=5 | ||
405 | fi | ||
406 | |||
407 | for ((i=0; i < MAGE_UNINSTALL_TIMEOUT; i++)) | ||
408 | do | ||
409 | timeout=$(expr ${MAGE_UNINSTALL_TIMEOUT} - ${i}) | ||
410 | echo -e "Starting in ${COLRED} ${timeout}" \ | ||
411 | "${COLDEFAULT} seconds ... ( [CTRL+C] to abort )" | ||
412 | sleep 1 | ||
413 | #moves the cursor up | ||
414 | echo -en \\033[A | ||
415 | done | ||
416 | |||
417 | #moves the cursor up | ||
418 | echo -en \\033[A | ||
419 | #min. 30 spaces needed for clearing up the rest of the line | ||
420 | echo -e "\nUninstall ${COLRED}started${COLDEFAULT} ..." \ | ||
421 | " \n" | ||
422 | sleep 1 | ||
423 | |||
424 | |||
425 | ##preremove scripte | ||
426 | export -f preremove 2> /dev/null | ||
427 | if [ "$?" == "0" ] | ||
428 | then | ||
429 | echo -e "\nRunning Preremove ... \n" | ||
430 | preremove | ||
431 | unset preremove | ||
432 | fi | ||
433 | |||
434 | #runs uninstall | ||
435 | build_douninstall ${PKGNAME} | ||
436 | |||
437 | #postremove scripte | ||
438 | export -f postremove 2> /dev/null | ||
439 | if [ "$?" == "0" ] | ||
440 | then | ||
441 | echo -e "\nRunning Postremove ... \n" | ||
442 | postremove | ||
443 | unset postremove | ||
444 | fi | ||
445 | |||
446 | #remove database entry | ||
447 | remove_database_entry ${PKGNAME} | ||
448 | |||
449 | #check for PROVIDE | ||
450 | # if so uninstall it from virtualdb | ||
451 | unregister_virtual_pkg | ||
452 | |||
453 | #rebuilds toplevel info node | ||
454 | echo -en "\n>>>> Rebuilding top-level info node ... " | ||
455 | ${MLIBDIR}/mkinfodir /usr/share/info > /usr/share/info/dir \ | ||
456 | && echo "done" || echo "false" | ||
457 | |||
458 | #rebuilds the enviroment with the content of /etc/env.d | ||
459 | ${MLIBDIR}/env-rebuild.sh | ||
460 | |||
461 | echo -e "\nPackage '${PKGNAME}' sucessfully removed.\n" | ||
462 | } | ||
463 | |||
464 | |||
465 | case "$1" in | ||
466 | download) | ||
467 | choppkgname | ||
468 | getcategorie | ||
469 | niro | 36 | get_highest_magefile || exit 1 |
470 | niro | 24 | source ${MAGEFILE} |
471 | getpackages | ||
472 | ;; | ||
473 | |||
474 | pretend) | ||
475 | choppkgname | ||
476 | getcategorie | ||
477 | niro | 36 | get_highest_magefile || exit 1 |
478 | niro | 24 | ${MLIBDIR}/depwanderer.sh pretend ${MAGEFILE} |
479 | #abort already installed | ||
480 | if [ "$?" == "3" ] | ||
481 | then | ||
482 | echo -en "Package " | ||
483 | echo -en "${COLRED}$(basename ${MAGEFILE} .mage)${COLDEFAULT}" | ||
484 | echo -e " already installed." | ||
485 | fi | ||
486 | ;; | ||
487 | |||
488 | srcpretend) | ||
489 | choppkgname | ||
490 | getcategorie | ||
491 | niro | 36 | get_highest_magefile || exit 1 |
492 | niro | 24 | ${MLIBDIR}/depwanderer.sh srcpretend ${MAGEFILE} |
493 | #abort already installed | ||
494 | if [ "$?" == "3" ] | ||
495 | then | ||
496 | echo -en "Package " | ||
497 | echo -en "${COLRED}$(basename ${MAGEFILE} .mage)${COLDEFAULT}" | ||
498 | echo -e " already installed." | ||
499 | fi | ||
500 | ;; | ||
501 | |||
502 | install) | ||
503 | #counter for protected files | ||
504 | declare -i PROTECT_COUNT=0 | ||
505 | choppkgname | ||
506 | getcategorie | ||
507 | niro | 36 | get_highest_magefile || exit 1 |
508 | niro | 24 | ALLDEPS="$(/usr/lib/mage/depwanderer.sh install ${MAGEFILE})" |
509 | #abort already installed | ||
510 | if [ "$?" == "3" ] | ||
511 | then | ||
512 | echo -en "Package " | ||
513 | echo -en "${COLRED}$(basename ${MAGEFILE} .mage)${COLDEFAULT}" | ||
514 | echo -e " already installed." | ||
515 | echo -e "Installation aborted." | ||
516 | exit 0 | ||
517 | fi | ||
518 | for i in ${ALLDEPS} | ||
519 | do | ||
520 | #first unset all vars to be safe | ||
521 | unset PKGNAME | ||
522 | unset STATE | ||
523 | unset DESCRIPTION | ||
524 | unset HOMEPAGE | ||
525 | unset DEPEND | ||
526 | unset SDEPEND | ||
527 | unset PROVIDE | ||
528 | unset PKGTYPE | ||
529 | unset preinstall | ||
530 | unset postinstall | ||
531 | |||
532 | niro | 56 | #then source an evtl new generated profile |
533 | [ -e /etc/profile ] && source /etc/profile | ||
534 | |||
535 | niro | 24 | #than install |
536 | MY_CAT_FIX="$(dirname ${i})" | ||
537 | CATEGORIE="$(basename ${MY_CAT_FIX%/*})" | ||
538 | mage_install ${i} | ||
539 | done | ||
540 | run_etc_update | ||
541 | ;; | ||
542 | |||
543 | srcinstall) | ||
544 | #counter for protected files | ||
545 | declare -i PROTECT_COUNT=0 | ||
546 | choppkgname | ||
547 | getcategorie | ||
548 | niro | 36 | get_highest_magefile || exit 1 |
549 | niro | 24 | ALLDEPS="$(/usr/lib/mage/depwanderer.sh srcinstall ${MAGEFILE})" |
550 | #abort already installed | ||
551 | if [ "$?" == "3" ] | ||
552 | then | ||
553 | echo -en "Package " | ||
554 | echo -en "${COLRED}$(basename ${MAGEFILE} .mage)${COLDEFAULT}" | ||
555 | echo -e " already installed." | ||
556 | echo -e "Installation aborted." | ||
557 | exit 0 | ||
558 | fi | ||
559 | for i in ${ALLDEPS} | ||
560 | do | ||
561 | #first unset all vars to be safe | ||
562 | unset PKGNAME | ||
563 | unset STATE | ||
564 | unset DESCRIPTION | ||
565 | unset HOMEPAGE | ||
566 | unset DEPEND | ||
567 | unset SDEPEND | ||
568 | unset PROVIDE | ||
569 | unset PKGTYPE | ||
570 | unset preinstall | ||
571 | unset postinstall | ||
572 | |||
573 | niro | 56 | #then source an evtl new generated profile |
574 | [ -e /etc/profile ] && source /etc/profile | ||
575 | |||
576 | niro | 24 | #than srcinstall |
577 | MY_CAT_FIX="$(dirname ${i})" | ||
578 | CATEGORIE="$(basename ${MY_CAT_FIX%/*})" | ||
579 | #builds the package from source | ||
580 | ${MLIBDIR}/sourceinstall.sh ${i} || exit 1 | ||
581 | done | ||
582 | run_etc_update | ||
583 | ;; | ||
584 | |||
585 | uninstall) | ||
586 | RESULT=$(get_magefile_to_uninstall ${MAGENAME}) | ||
587 | #get_magefile_to_uninstall ${MAGENAME} | ||
588 | #echo $? | ||
589 | #read | ||
590 | case $? in | ||
591 | 0) | ||
592 | #MAGENAME=${RESULT} | ||
593 | #mage_uninstall | ||
594 | mage_uninstall ${RESULT} | ||
595 | ;; | ||
596 | 1) | ||
597 | echo "No package found named '${RESULT}'." | ||
598 | exit 1 | ||
599 | ;; | ||
600 | 2) | ||
601 | echo -e ${COLRED}"Warning: More than one package found ..."${COLDEFAULT} | ||
602 | echo | ||
603 | echo "Please select the package you want to uninstall:" | ||
604 | echo | ||
605 | declare -i i=0 | ||
606 | declare -i USERSEL=0 | ||
607 | for x in ${RESULT} | ||
608 | do | ||
609 | echo -e "\t${COLBLUE}[${i}] ${COLGREEN}$(basename ${x})${COLDEFAULT}" | ||
610 | SELECTION[${i}]=${x} | ||
611 | i=${i}+1 | ||
612 | done | ||
613 | echo | ||
614 | echo -n "Choose a number: " | ||
615 | read USERSEL | ||
616 | |||
617 | if [ ${USERSEL} -ge 0 -a ${USERSEL} -le ${i} ] | ||
618 | then | ||
619 | #the correct magefile | ||
620 | #MAGENAME="${SELECTION[${USERSEL}]}/$(basename ${SELECTION[${USERSEL}]}).mage" | ||
621 | MAGENAME="${SELECTION[${USERSEL}]}" | ||
622 | mage_uninstall ${MAGENAME} | ||
623 | else | ||
624 | echo "Wrong input. Uninstall abortet ..." | ||
625 | exit 1 | ||
626 | fi | ||
627 | #echo | ||
628 | #echo "Uninstallation Aborted." | ||
629 | #exit 1 | ||
630 | ;; | ||
631 | esac | ||
632 | ;; | ||
633 | |||
634 | search) | ||
635 | ${MLIBDIR}/pkgsearch.sh ${MAGENAME} | ||
636 | ;; | ||
637 | |||
638 | unpack) | ||
639 | build_unpackpkg | ||
640 | ;; | ||
641 | |||
642 | update) | ||
643 | syncmage | ||
644 | ;; | ||
645 | clean) | ||
646 | cleanpkg | ||
647 | ;; | ||
648 | keepfiles) | ||
649 | keepfiles "$2" "$3" | ||
650 | ;; | ||
651 | inject) | ||
652 | injectpkg "$2" | ||
653 | ;; | ||
654 | reminjected) | ||
655 | reminjected | ||
656 | ;; | ||
657 | version) | ||
658 | showversion | ||
659 | ;; | ||
660 | *) | ||
661 | print_usage | ||
662 | ;; | ||
663 | esac |
Properties
Name | Value |
---|---|
svn:executable | * |