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.16 2007-01-21 23:46:24 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 || \ |
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" |
114 |
showversion |
showversion |
115 |
echo |
echo |
116 |
|
|
|
# before anything run mage_setup |
|
|
mage_setup || die "error in mage_setup()" |
|
|
|
|
117 |
# install method |
# install method |
118 |
METHOD="$1" |
METHOD="$1" |
119 |
|
|
140 |
BUILDDIR=${MROOT}/${BUILDDIR} |
BUILDDIR=${MROOT}/${BUILDDIR} |
141 |
fi |
fi |
142 |
|
|
143 |
|
# before anything run mage_setup |
144 |
|
mage_setup || die "error in mage_setup()" |
145 |
|
|
146 |
case ${METHOD} in |
case ${METHOD} in |
147 |
download) |
download) |
148 |
# first of all get the right pkg which going to be installed |
# first of all get the right pkg which going to be installed |
154 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
155 |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
156 |
|
|
157 |
|
# package is masked |
158 |
|
[ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation." |
159 |
|
|
160 |
# convert PKGNAME to PNAME/PVER/PBUILD |
# convert PKGNAME to PNAME/PVER/PBUILD |
161 |
# we're working *only* with these three vars from here on |
# we're working *only* with these three vars from here on |
162 |
PNAME="$(pkgname2pname ${PKGNAME})" |
PNAME="$(pkgname2pname ${PKGNAME})" |
184 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
185 |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
186 |
|
|
187 |
|
# package is masked |
188 |
|
[ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation." |
189 |
|
|
190 |
# convert PKGNAME to PNAME/PVER/PBUILD |
# convert PKGNAME to PNAME/PVER/PBUILD |
191 |
# we're working *only* with these three vars from here on |
# we're working *only* with these three vars from here on |
192 |
PNAME="$(pkgname2pname ${PKGNAME})" |
PNAME="$(pkgname2pname ${PKGNAME})" |
213 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
214 |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
215 |
|
|
216 |
|
# package is masked |
217 |
|
[ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation." |
218 |
|
|
219 |
# convert PKGNAME to PNAME/PVER/PBUILD |
# convert PKGNAME to PNAME/PVER/PBUILD |
220 |
# we're working *only* with these three vars from here on |
# we're working *only* with these three vars from here on |
221 |
PNAME="$(pkgname2pname ${PKGNAME})" |
PNAME="$(pkgname2pname ${PKGNAME})" |
249 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
250 |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
251 |
|
|
252 |
|
# package is masked |
253 |
|
[ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation." |
254 |
|
|
255 |
# convert PKGNAME to PNAME/PVER/PBUILD |
# convert PKGNAME to PNAME/PVER/PBUILD |
256 |
# we're working *only* with these three vars from here on |
# we're working *only* with these three vars from here on |
257 |
PNAME="$(pkgname2pname ${PKGNAME})" |
PNAME="$(pkgname2pname ${PKGNAME})" |
291 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
292 |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
293 |
|
|
294 |
|
# package is masked |
295 |
|
[ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation." |
296 |
|
|
297 |
# convert PKGNAME to PNAME/PVER/PBUILD |
# convert PKGNAME to PNAME/PVER/PBUILD |
298 |
# we're working *only* with these three vars from here on |
# we're working *only* with these three vars from here on |
299 |
PNAME="$(pkgname2pname ${PKGNAME})" |
PNAME="$(pkgname2pname ${PKGNAME})" |
381 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
382 |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
383 |
|
|
384 |
|
# package is masked |
385 |
|
[ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation." |
386 |
|
|
387 |
# convert PKGNAME to PNAME/PVER/PBUILD |
# convert PKGNAME to PNAME/PVER/PBUILD |
388 |
# we're working *only* with these three vars from here on |
# we're working *only* with these three vars from here on |
389 |
PNAME="$(pkgname2pname ${PKGNAME})" |
PNAME="$(pkgname2pname ${PKGNAME})" |