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() |
7 |
{ |
{ |
8 |
echo -e ${COLRED}"Exited ${BASH_SOURCE} at line no ${BASH_LINENO}."${COLDEFAULT} |
xtitleclean |
9 |
|
mqueryfeature "debug" && echo -e ${COLRED}"Exited ${BASH_SOURCE} at line no ${BASH_LINENO}."${COLDEFAULT} |
10 |
echo -e ${COLRED}"$@"${COLDEFAULT} |
echo -e ${COLRED}"$@"${COLDEFAULT} |
11 |
exit 1 |
exit 1 |
12 |
} |
} |
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 " search - searches mage-tree for a package" |
echo " search - searches mage-tree for a package" |
76 |
echo " clean - removes *all* downloaded packages" |
echo " clean - removes *all* downloaded packages" |
77 |
echo " unpack - unpacks *all* needed package for 'foo'" |
echo " unpack - unpacks *all* needed package for 'foo'" |
110 |
[[ ${METHOD} != uppretend ]] && |
[[ ${METHOD} != uppretend ]] && |
111 |
[[ ${METHOD} != srcuppretend ]] && |
[[ ${METHOD} != srcuppretend ]] && |
112 |
[[ ${METHOD} != update ]] && |
[[ ${METHOD} != update ]] && |
113 |
|
[[ ${METHOD} != update-rsync ]] && |
114 |
[[ ${METHOD} != update-tarball ]] && |
[[ ${METHOD} != update-tarball ]] && |
115 |
[[ ${METHOD} != clean ]] && |
[[ ${METHOD} != clean ]] && |
116 |
[[ ${METHOD} != version ]] && |
[[ ${METHOD} != version ]] && |
144 |
|
|
145 |
case ${METHOD} in |
case ${METHOD} in |
146 |
download) |
download) |
147 |
|
have_root_privileges || die "You must be root to run this operation." |
148 |
|
|
149 |
# first of all get the right pkg which going to be installed |
# first of all get the right pkg which going to be installed |
150 |
PCAT="$(pname2pcat ${MAGENAME})" |
PCAT="$(pname2pcat ${MAGENAME})" |
151 |
|
|
177 |
;; |
;; |
178 |
|
|
179 |
srcdownload) |
srcdownload) |
180 |
|
have_root_privileges || die "You must be root to run this operation." |
181 |
|
|
182 |
# first of all get the right pkg which going to be installed |
# first of all get the right pkg which going to be installed |
183 |
PCAT="$(pname2pcat ${MAGENAME})" |
PCAT="$(pname2pcat ${MAGENAME})" |
184 |
|
|
427 |
|
|
428 |
update) |
update) |
429 |
have_root_privileges || die "You must be root to run this operation." |
have_root_privileges || die "You must be root to run this operation." |
430 |
|
# default to tarball |
431 |
|
[[ -z ${MAGE_UPDATE_METHOD} ]] && MAGE_UPDATE_METHOD="tarball" |
432 |
|
case ${MAGE_UPDATE_METHOD} in |
433 |
|
rsync) syncmage ;; |
434 |
|
tarball) syncmage_tarball ;; |
435 |
|
*) die "Unknown MAGE_UPDATE_METHOD defined." ;; |
436 |
|
esac |
437 |
|
;; |
438 |
|
|
439 |
|
update-rsync) |
440 |
|
have_root_privileges || die "You must be root to run this operation." |
441 |
syncmage |
syncmage |
442 |
;; |
;; |
443 |
|
|