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.7 2005-09-27 14:36:57 niro Exp $ |
# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/mage4.sh,v 1.9 2005-12-01 12:40:21 niro Exp $ |
4 |
|
|
5 |
# default die function |
# default die function |
6 |
die() |
die() |
81 |
echo |
echo |
82 |
echo "Usage: $(basename $0) [option] pkgname ..." |
echo "Usage: $(basename $0) [option] pkgname ..." |
83 |
echo "Options:" |
echo "Options:" |
84 |
echo " pretend - pretends dependencies of a package" |
echo " pretend - pretends dependencies of a package" |
85 |
echo " srcpretend - pretends dependencies of a package (build from source)" |
echo " srcpretend - pretends dependencies of a package (build from source)" |
86 |
echo " install - installs a package" |
echo " install - installs a package" |
87 |
echo " srcinstall - installs a package from source" |
echo " srcinstall - installs a package from source" |
88 |
echo " uninstall - removes a package" |
echo " uninstall - removes a package" |
89 |
echo " update - updates mage-tree" |
echo " update - updates mage-tree" |
90 |
echo " uppretend - pretend dependencies for a system upgrade" |
echo " uppretend - pretend dependencies for a system upgrade" |
91 |
echo " upgrade - runs a complete system upgrade" |
echo " upgrade - runs a complete system upgrade" |
92 |
echo " srcuppretend - pretend dependencies for a system upgrade from source" |
echo " srcuppretend - pretend dependencies for a system upgrade from source" |
93 |
echo " srcupgrade - runs a complete system upgrade from source" |
echo " srcupgrade - runs a complete system upgrade from source" |
94 |
echo " search - searches mage-tree for a package" |
echo " search - searches mage-tree for a package" |
95 |
echo " clean - removes *all* downloaded packages" |
echo " clean - removes *all* downloaded packages" |
96 |
echo " unpack - unpacks *all* needed package for 'foo'" |
echo " unpack - unpacks *all* needed package for 'foo'" |
97 |
echo " download - downloads *all* needed packages for 'foo'" |
echo " download - downloads *all* needed packages for 'foo'" |
98 |
echo " version - prints version info" |
echo " version - prints version info" |
99 |
|
echo " regen-mage-tree - regenerates the whole mage database (for devs only)" |
100 |
echo |
echo |
101 |
echo "Other options:" |
echo "Other options:" |
102 |
# echo "NOINSTALL=yes $(basename $0) srcinstall PACKAGE" |
# echo "NOINSTALL=yes $(basename $0) srcinstall PACKAGE" |
139 |
[[ -z ${METHOD} ]] || [[ -z ${MAGENAME} ]] && print_usage && exit 1 |
[[ -z ${METHOD} ]] || [[ -z ${MAGENAME} ]] && print_usage && exit 1 |
140 |
fi |
fi |
141 |
|
|
142 |
|
# set PKGDIR and BUILDDIR to MROOT |
143 |
|
if [[ -n ${MROOT} ]] |
144 |
|
then |
145 |
|
PKGDIR=${MROOT}/${PKGDIR} |
146 |
|
BUILDDIR=${MROOT}/${BUILDDIR} |
147 |
|
fi |
148 |
|
|
149 |
case ${METHOD} in |
case ${METHOD} in |
150 |
download) |
download) |
155 |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
156 |
|
|
157 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
158 |
source $(get_highest_magefile ${PCAT} ${MAGENAME}) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
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 |
182 |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
183 |
|
|
184 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
185 |
source $(get_highest_magefile ${PCAT} ${MAGENAME}) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
186 |
|
|
187 |
# convert PKGNAME to PNAME/PVER/PBUILD |
# convert PKGNAME to PNAME/PVER/PBUILD |
188 |
# we're working *only* with these three vars from here on |
# we're working *only* with these three vars from here on |
208 |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
209 |
|
|
210 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
211 |
source $(get_highest_magefile ${PCAT} ${MAGENAME}) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
212 |
|
|
213 |
# convert PKGNAME to PNAME/PVER/PBUILD |
# convert PKGNAME to PNAME/PVER/PBUILD |
214 |
# we're working *only* with these three vars from here on |
# we're working *only* with these three vars from here on |
241 |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
242 |
|
|
243 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
244 |
source $(get_highest_magefile ${PCAT} ${MAGENAME}) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
245 |
|
|
246 |
# convert PKGNAME to PNAME/PVER/PBUILD |
# convert PKGNAME to PNAME/PVER/PBUILD |
247 |
# we're working *only* with these three vars from here on |
# we're working *only* with these three vars from here on |
280 |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
281 |
|
|
282 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
283 |
source $(get_highest_magefile ${PCAT} ${MAGENAME}) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
284 |
|
|
285 |
# convert PKGNAME to PNAME/PVER/PBUILD |
# convert PKGNAME to PNAME/PVER/PBUILD |
286 |
# we're working *only* with these three vars from here on |
# we're working *only* with these three vars from here on |
367 |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
368 |
|
|
369 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
370 |
source $(get_highest_magefile ${PCAT} ${MAGENAME}) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
371 |
|
|
372 |
# convert PKGNAME to PNAME/PVER/PBUILD |
# convert PKGNAME to PNAME/PVER/PBUILD |
373 |
# we're working *only* with these three vars from here on |
# we're working *only* with these three vars from here on |