1 |
#!/bin/bash |
#!/bin/bash |
2 |
# Magellan Linux Installer (mage.sh) |
# Magellan Linux Installer (mage.sh) |
3 |
# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/mage4.sh,v 1.17 2008-06-16 09:29:57 niro Exp $ |
# $Id$ |
4 |
|
|
5 |
# default die function |
# default die function |
6 |
die() |
die() |
32 |
# sanity checks |
# sanity checks |
33 |
[ ! -e ${VIRTUALDB_FILE} ] && touch ${VIRTUALDB_FILE} |
[ ! -e ${VIRTUALDB_FILE} ] && touch ${VIRTUALDB_FILE} |
34 |
|
|
35 |
if [ ! -e ${VIRTUALDB_DEFAULTS} ] && [[ $1 != update ]] && [[ $1 != update-tarball ]] |
if [ ! -e ${VIRTUALDB_DEFAULTS} ] && |
36 |
|
[[ $1 != update ]] && |
37 |
|
[[ $1 != update-rsync ]] && |
38 |
|
[[ $1 != update-tarball ]] |
39 |
then |
then |
40 |
echo |
echo |
41 |
echo "Please choose an profile from the mage tree." |
echo "Please choose an profile from the mage tree." |
63 |
echo " install - installs a package" |
echo " install - installs a package" |
64 |
echo " srcinstall - installs a package from source" |
echo " srcinstall - installs a package from source" |
65 |
echo " uninstall - removes a package" |
echo " uninstall - removes a package" |
66 |
echo " update - updates the mage-tree via rsync" |
echo " update - updates the mage-tree via default sync method" |
67 |
|
echo " update-rsync - updates the mage-tree via rsync" |
68 |
echo " update-tarball - updates the mage-tree via a tarball" |
echo " update-tarball - updates the mage-tree via a tarball" |
69 |
echo " uppretend - pretend dependencies for a system upgrade" |
echo " uppretend - pretend dependencies for a system upgrade" |
70 |
echo " upgrade - runs a complete system upgrade" |
echo " upgrade - runs a complete system upgrade" |
71 |
echo " srcuppretend - pretend dependencies for a system upgrade from source" |
echo " srcuppretend - pretend dependencies for a system upgrade from source" |
72 |
echo " srcupgrade - runs a complete system upgrade from source" |
echo " srcupgrade - runs a complete system upgrade from source" |
73 |
echo " pretend-build-prerequisites" |
echo " pretend-build-prerequisites - prints build prerequisites" |
74 |
echo " install-build-prerequisites" |
echo " install-build-prerequisites - install build prerequisites" |
75 |
|
echo " run-preinstall - runs preinstall part of an installed package" |
76 |
|
echo " run-postinstall - runs postinstall part of an installed package" |
77 |
echo " search - searches mage-tree for a package" |
echo " search - searches mage-tree for a package" |
78 |
echo " clean - removes *all* downloaded packages" |
echo " clean - removes *all* downloaded packages" |
79 |
echo " unpack - unpacks *all* needed package for 'foo'" |
echo " unpack - unpacks *all* needed package for 'foo'" |
112 |
[[ ${METHOD} != uppretend ]] && |
[[ ${METHOD} != uppretend ]] && |
113 |
[[ ${METHOD} != srcuppretend ]] && |
[[ ${METHOD} != srcuppretend ]] && |
114 |
[[ ${METHOD} != update ]] && |
[[ ${METHOD} != update ]] && |
115 |
|
[[ ${METHOD} != update-rsync ]] && |
116 |
[[ ${METHOD} != update-tarball ]] && |
[[ ${METHOD} != update-tarball ]] && |
117 |
[[ ${METHOD} != clean ]] && |
[[ ${METHOD} != clean ]] && |
118 |
[[ ${METHOD} != version ]] && |
[[ ${METHOD} != version ]] && |
343 |
uninstall_packages ${ALLDEPS} |
uninstall_packages ${ALLDEPS} |
344 |
;; |
;; |
345 |
|
|
346 |
|
run-preinstall|run-postinstall) |
347 |
|
have_root_privileges || die "You must be root to run this operation." |
348 |
|
|
349 |
|
ALLDEPS="$(get_uninstall_candidates --pname ${MAGENAME})" |
350 |
|
if [ -z "${ALLDEPS}" ] |
351 |
|
then |
352 |
|
die "No package installed named '${MAGENAME}'." |
353 |
|
fi |
354 |
|
rerun_pkgfunctions --method "${METHOD//run-}" ${ALLDEPS} |
355 |
|
;; |
356 |
|
|
357 |
uppretend|srcuppretend) |
uppretend|srcuppretend) |
358 |
${MLIBDIR}/depwalker.sh \ |
${MLIBDIR}/depwalker.sh \ |
359 |
--method ${METHOD} \ |
--method ${METHOD} \ |
440 |
|
|
441 |
update) |
update) |
442 |
have_root_privileges || die "You must be root to run this operation." |
have_root_privileges || die "You must be root to run this operation." |
443 |
|
# default to tarball |
444 |
|
[[ -z ${MAGE_UPDATE_METHOD} ]] && MAGE_UPDATE_METHOD="tarball" |
445 |
|
case ${MAGE_UPDATE_METHOD} in |
446 |
|
rsync) syncmage ;; |
447 |
|
tarball) syncmage_tarball ;; |
448 |
|
*) die "Unknown MAGE_UPDATE_METHOD defined." ;; |
449 |
|
esac |
450 |
|
;; |
451 |
|
|
452 |
|
update-rsync) |
453 |
|
have_root_privileges || die "You must be root to run this operation." |
454 |
syncmage |
syncmage |
455 |
;; |
;; |
456 |
|
|