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.6 2005-09-11 19:46:05 niro Exp $ |
# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/mage4.sh,v 1.8 2005-10-03 13:48:06 niro Exp $ |
4 |
|
|
5 |
# default die function |
# default die function |
6 |
die() |
die() |
148 |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
149 |
|
|
150 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
151 |
source $(get_highest_magefile ${PCAT} ${MAGENAME}) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
152 |
|
|
153 |
# convert PKGNAME to PNAME/PVER/PBUILD |
# convert PKGNAME to PNAME/PVER/PBUILD |
154 |
# we're working *only* with these three vars from here on |
# we're working *only* with these three vars from here on |
175 |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
176 |
|
|
177 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
178 |
source $(get_highest_magefile ${PCAT} ${MAGENAME}) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
179 |
|
|
180 |
# convert PKGNAME to PNAME/PVER/PBUILD |
# convert PKGNAME to PNAME/PVER/PBUILD |
181 |
# we're working *only* with these three vars from here on |
# we're working *only* with these three vars from here on |
201 |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
202 |
|
|
203 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
204 |
source $(get_highest_magefile ${PCAT} ${MAGENAME}) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
205 |
|
|
206 |
# convert PKGNAME to PNAME/PVER/PBUILD |
# convert PKGNAME to PNAME/PVER/PBUILD |
207 |
# we're working *only* with these three vars from here on |
# we're working *only* with these three vars from here on |
234 |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
235 |
|
|
236 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
237 |
source $(get_highest_magefile ${PCAT} ${MAGENAME}) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
238 |
|
|
239 |
# convert PKGNAME to PNAME/PVER/PBUILD |
# convert PKGNAME to PNAME/PVER/PBUILD |
240 |
# we're working *only* with these three vars from here on |
# we're working *only* with these three vars from here on |
245 |
if is_installed ${PCAT}/${PNAME}-${PVER}-${PBUILD} |
if is_installed ${PCAT}/${PNAME}-${PVER}-${PBUILD} |
246 |
then |
then |
247 |
echo -en "Package " |
echo -en "Package " |
248 |
echo -en "${COLRED}${PNAME}-${PVER}-${PBUILD}${COLDEFAULT}" |
echo -en "${COLRED}${PCAT}/${PNAME}-${PVER}-${PBUILD}${COLDEFAULT}" |
249 |
echo -e " already installed." |
echo -e " already installed." |
250 |
exit 3 |
exit 3 |
251 |
fi |
fi |
273 |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
274 |
|
|
275 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
276 |
source $(get_highest_magefile ${PCAT} ${MAGENAME}) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
277 |
|
|
278 |
# convert PKGNAME to PNAME/PVER/PBUILD |
# convert PKGNAME to PNAME/PVER/PBUILD |
279 |
# we're working *only* with these three vars from here on |
# we're working *only* with these three vars from here on |
284 |
if is_installed ${PCAT}/${PNAME}-${PVER}-${PBUILD} |
if is_installed ${PCAT}/${PNAME}-${PVER}-${PBUILD} |
285 |
then |
then |
286 |
echo -en "Package " |
echo -en "Package " |
287 |
echo -en "${COLRED}${PNAME}-${PVER}-${PBUILD}${COLDEFAULT}" |
echo -en "${COLRED}${PCAT}/${PNAME}-${PVER}-${PBUILD}${COLDEFAULT}" |
288 |
echo -e " already installed." |
echo -e " already installed." |
289 |
exit 3 |
exit 3 |
290 |
fi |
fi |
318 |
--pbuild ${METHOD} |
--pbuild ${METHOD} |
319 |
;; |
;; |
320 |
|
|
321 |
upgrade|srcupgrade) |
upgrade) |
322 |
# get all dependencies of *all* installed packages |
# get all dependencies of *all* installed packages |
323 |
# fake pcat,pname,pver,pbuild ... |
# fake pcat,pname,pver,pbuild ... |
324 |
ALLDEPS="$(${MLIBDIR}/depwalker.sh \ |
ALLDEPS="$(${MLIBDIR}/depwalker.sh \ |
328 |
--pver ${METHOD} \ |
--pver ${METHOD} \ |
329 |
--pbuild ${METHOD})" |
--pbuild ${METHOD})" |
330 |
|
|
331 |
echo "DEBUG: ${ALLDEPS}" |
# first fetch all packages |
332 |
|
fetch_packages ${ALLDEPS} || die "fetching packages" |
333 |
|
md5sum_packages ${ALLDEPS} || die "md5 sum packages" |
334 |
|
unpack_packages ${ALLDEPS} || die "unpacking packages" |
335 |
|
install_packages ${ALLDEPS} || die "installing packages" |
336 |
|
;; |
337 |
|
|
338 |
|
srcupgrade) |
339 |
|
# get all dependencies of *all* installed packages |
340 |
|
# fake pcat,pname,pver,pbuild ... |
341 |
|
ALLDEPS="$(${MLIBDIR}/depwalker.sh \ |
342 |
|
--method ${METHOD} \ |
343 |
|
--pcat ${METHOD} \ |
344 |
|
--pname ${METHOD} \ |
345 |
|
--pver ${METHOD} \ |
346 |
|
--pbuild ${METHOD})" |
347 |
|
|
348 |
|
install_packages --src-install ${ALLDEPS} || die "src-installing packages" |
349 |
;; |
;; |
350 |
|
|
351 |
search) |
search) |
360 |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
[ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist." |
361 |
|
|
362 |
# source the highest magefile of this pkg |
# source the highest magefile of this pkg |
363 |
source $(get_highest_magefile ${PCAT} ${MAGENAME}) |
PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME})) |
364 |
|
|
365 |
# convert PKGNAME to PNAME/PVER/PBUILD |
# convert PKGNAME to PNAME/PVER/PBUILD |
366 |
# we're working *only* with these three vars from here on |
# we're working *only* with these three vars from here on |