1 |
#!/bin/sh |
#!/bin/sh |
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.10 2005-12-04 12:02:21 niro Exp $ |
# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/mage4.sh,v 1.17 2008-06-16 09:29:57 niro Exp $ |
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} |
9 |
echo -e ${COLRED}"$@"${COLDEFAULT} |
echo -e ${COLRED}"$@"${COLDEFAULT} |
10 |
exit 1 |
exit 1 |
11 |
} |
} |
15 |
source /etc/mage.rc.global || \ |
source /etc/mage.rc.global || \ |
16 |
die "/etc/mage.rc.global missing" |
die "/etc/mage.rc.global missing" |
17 |
|
|
18 |
[ -f /etc/mage.rc ] && source /etc/mage.rc || \ |
[ -f ${MAGERC} ] && source ${MAGERC} || \ |
19 |
die "Your /etc/mage.rc is missing. Aborting." |
die "Your ${MAGERC} is missing. Aborting." |
20 |
|
|
21 |
[ -f ${MLIBDIR}/mage4.functions.sh ] && \ |
[ -f ${MLIBDIR}/mage4.functions.sh ] && \ |
22 |
source ${MLIBDIR}/mage4.functions.sh || \ |
source ${MLIBDIR}/mage4.functions.sh || \ |
55 |
# sanity checks |
# sanity checks |
56 |
[ ! -e ${VIRTUALDB_FILE} ] && touch ${VIRTUALDB_FILE} |
[ ! -e ${VIRTUALDB_FILE} ] && touch ${VIRTUALDB_FILE} |
57 |
|
|
58 |
if [ ! -e ${VIRTUALDB_DEFAULTS} ] && [[ $1 != update ]] |
if [ ! -e ${VIRTUALDB_DEFAULTS} ] && [[ $1 != update ]] && [[ $1 != update-tarball ]] |
59 |
then |
then |
60 |
echo |
echo |
61 |
echo "Please choose an profile from the mage tree." |
echo "Please choose an profile from the mage tree." |
74 |
|
|
75 |
print_usage() |
print_usage() |
76 |
{ |
{ |
77 |
showversion |
#showversion |
78 |
echo |
#echo |
79 |
echo "Usage: $(basename $0) [option] pkgname ..." |
echo "Usage: $(basename $0) [option] pkgname ..." |
80 |
echo "Options:" |
echo "Options:" |
81 |
echo " pretend - pretends dependencies of a package" |
echo " pretend - pretends dependencies of a package" |
83 |
echo " install - installs a package" |
echo " install - installs a package" |
84 |
echo " srcinstall - installs a package from source" |
echo " srcinstall - installs a package from source" |
85 |
echo " uninstall - removes a package" |
echo " uninstall - removes a package" |
86 |
echo " update - updates mage-tree" |
echo " update - updates the mage-tree via rsync" |
87 |
|
echo " update-tarball - updates the mage-tree via a tarball" |
88 |
echo " uppretend - pretend dependencies for a system upgrade" |
echo " uppretend - pretend dependencies for a system upgrade" |
89 |
echo " upgrade - runs a complete system upgrade" |
echo " upgrade - runs a complete system upgrade" |
90 |
echo " srcuppretend - pretend dependencies for a system upgrade from source" |
echo " srcuppretend - pretend dependencies for a system upgrade from source" |
115 |
showversion |
showversion |
116 |
echo |
echo |
117 |
|
|
|
# before anything run mage_setup |
|
|
mage_setup || die "error in mage_setup()" |
|
|
|
|
118 |
# install method |
# install method |
119 |
METHOD="$1" |
METHOD="$1" |
120 |
|
|
126 |
[[ ${METHOD} != uppretend ]] && \ |
[[ ${METHOD} != uppretend ]] && \ |
127 |
[[ ${METHOD} != srcuppretend ]] && \ |
[[ ${METHOD} != srcuppretend ]] && \ |
128 |
[[ ${METHOD} != update ]] && \ |
[[ ${METHOD} != update ]] && \ |
129 |
|
[[ ${METHOD} != update-tarball ]] && \ |
130 |
[[ ${METHOD} != clean ]] && \ |
[[ ${METHOD} != clean ]] && \ |
131 |
[[ ${METHOD} != version ]] && \ |
[[ ${METHOD} != version ]] && \ |
132 |
[[ ${METHOD} != search ]] && \ |
[[ ${METHOD} != search ]] && \ |
142 |
BUILDDIR=${MROOT}/${BUILDDIR} |
BUILDDIR=${MROOT}/${BUILDDIR} |
143 |
fi |
fi |
144 |
|
|
145 |
|
# before anything run mage_setup |
146 |
|
mage_setup || die "error in mage_setup()" |
147 |
|
|
148 |
case ${METHOD} in |
case ${METHOD} in |
149 |
download) |
download) |
150 |
# first of all get the right pkg which going to be installed |
# first of all get the right pkg which going to be installed |
156 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
157 |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
158 |
|
|
159 |
|
# package is masked |
160 |
|
[ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation." |
161 |
|
|
162 |
# convert PKGNAME to PNAME/PVER/PBUILD |
# convert PKGNAME to PNAME/PVER/PBUILD |
163 |
# we're working *only* with these three vars from here on |
# we're working *only* with these three vars from here on |
164 |
PNAME="$(pkgname2pname ${PKGNAME})" |
PNAME="$(pkgname2pname ${PKGNAME})" |
186 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
187 |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
188 |
|
|
189 |
|
# package is masked |
190 |
|
[ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation." |
191 |
|
|
192 |
# convert PKGNAME to PNAME/PVER/PBUILD |
# convert PKGNAME to PNAME/PVER/PBUILD |
193 |
# we're working *only* with these three vars from here on |
# we're working *only* with these three vars from here on |
194 |
PNAME="$(pkgname2pname ${PKGNAME})" |
PNAME="$(pkgname2pname ${PKGNAME})" |
215 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
216 |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
217 |
|
|
218 |
|
# package is masked |
219 |
|
[ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation." |
220 |
|
|
221 |
# convert PKGNAME to PNAME/PVER/PBUILD |
# convert PKGNAME to PNAME/PVER/PBUILD |
222 |
# we're working *only* with these three vars from here on |
# we're working *only* with these three vars from here on |
223 |
PNAME="$(pkgname2pname ${PKGNAME})" |
PNAME="$(pkgname2pname ${PKGNAME})" |
251 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
252 |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
253 |
|
|
254 |
|
# package is masked |
255 |
|
[ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation." |
256 |
|
|
257 |
# convert PKGNAME to PNAME/PVER/PBUILD |
# convert PKGNAME to PNAME/PVER/PBUILD |
258 |
# we're working *only* with these three vars from here on |
# we're working *only* with these three vars from here on |
259 |
PNAME="$(pkgname2pname ${PKGNAME})" |
PNAME="$(pkgname2pname ${PKGNAME})" |
293 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
294 |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
295 |
|
|
296 |
|
# package is masked |
297 |
|
[ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation." |
298 |
|
|
299 |
# convert PKGNAME to PNAME/PVER/PBUILD |
# convert PKGNAME to PNAME/PVER/PBUILD |
300 |
# we're working *only* with these three vars from here on |
# we're working *only* with these three vars from here on |
301 |
PNAME="$(pkgname2pname ${PKGNAME})" |
PNAME="$(pkgname2pname ${PKGNAME})" |
383 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
384 |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
385 |
|
|
386 |
|
# package is masked |
387 |
|
[ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation." |
388 |
|
|
389 |
# convert PKGNAME to PNAME/PVER/PBUILD |
# convert PKGNAME to PNAME/PVER/PBUILD |
390 |
# we're working *only* with these three vars from here on |
# we're working *only* with these three vars from here on |
391 |
PNAME="$(pkgname2pname ${PKGNAME})" |
PNAME="$(pkgname2pname ${PKGNAME})" |
408 |
syncmage |
syncmage |
409 |
;; |
;; |
410 |
|
|
411 |
|
update-tarball) |
412 |
|
syncmage_tarball |
413 |
|
;; |
414 |
|
|
415 |
clean) |
clean) |
416 |
cleanpkg |
cleanpkg |
417 |
;; |
;; |