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.4 2005-09-09 18:05:45 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() |
10 |
} |
} |
11 |
|
|
12 |
# include all needed files |
# include all needed files |
13 |
[ -f ${MLIBDIR}/conf/mage.rc.global ] && \ |
[ -f /etc/mage.rc.global ] && \ |
14 |
source ${MLIBDIR}/conf/mage.rc.global || \ |
source /etc/mage.rc.global || \ |
15 |
die "${MLIBDIR}/conf/mage.rc.global missing" |
die "/etc/mage.rc.global missing" |
16 |
|
|
17 |
[ -f /etc/mage.rc ] && source /etc/mage.rc || \ |
[ -f /etc/mage.rc ] && source /etc/mage.rc || \ |
18 |
die "Your /etc/mage.rc is missing. Aborting." |
die "Your /etc/mage.rc is missing. Aborting." |
19 |
|
|
20 |
[ -f ${MLIBDIR}/mage.functions.sh ] && \ |
[ -f ${MLIBDIR}/mage4.functions.sh ] && \ |
21 |
source ${MLIBDIR}/mage.functions.sh || \ |
source ${MLIBDIR}/mage4.functions.sh || \ |
22 |
die "mage functions missing" |
die "mage functions missing" |
23 |
|
|
24 |
# for tests only |
# for tests only |
30 |
## only for tests -> normally in /etc/rc.d/init.d/functions |
## only for tests -> normally in /etc/rc.d/init.d/functions |
31 |
COLRED="\033[1;6m\033[31m" |
COLRED="\033[1;6m\033[31m" |
32 |
COLGREEN="\033[1;6m\033[32m" |
COLGREEN="\033[1;6m\033[32m" |
33 |
|
COLYELLOW="\033[1;6m\033[33m" |
34 |
COLBLUE="\033[1;6m\033[34m" |
COLBLUE="\033[1;6m\033[34m" |
35 |
|
COLMAGENTA="\033[1;6m\033[35m" |
36 |
|
COLWHITE="\033[1;6m\033[37m" |
37 |
|
COLGRAY="\033[0;6m\033[37m" |
38 |
|
COLBOLD="\033[1m" |
39 |
COLDEFAULT="\033[0m" |
COLDEFAULT="\033[0m" |
40 |
|
|
41 |
if [[ ${NOCOLORS} = true ]] |
if [[ ${NOCOLORS} = true ]] |
46 |
COLBLUE="" |
COLBLUE="" |
47 |
COLMAGENTA="" |
COLMAGENTA="" |
48 |
COLWHITE="" |
COLWHITE="" |
49 |
|
COLGRAY="" |
50 |
|
COLBOLD="" |
51 |
COLDEFAULT="" |
COLDEFAULT="" |
52 |
fi |
fi |
53 |
|
|
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 |
323 |
|
# fake pcat,pname,pver,pbuild ... |
324 |
|
ALLDEPS="$(${MLIBDIR}/depwalker.sh \ |
325 |
|
--method ${METHOD} \ |
326 |
|
--pcat ${METHOD} \ |
327 |
|
--pname ${METHOD} \ |
328 |
|
--pver ${METHOD} \ |
329 |
|
--pbuild ${METHOD})" |
330 |
|
|
331 |
|
# 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 |
# get all dependencies of *all* installed packages |
340 |
# fake pcat,pname,pver,pbuild ... |
# fake pcat,pname,pver,pbuild ... |
341 |
ALLDEPS="$(${MLIBDIR}/depwalker.sh \ |
ALLDEPS="$(${MLIBDIR}/depwalker.sh \ |
345 |
--pver ${METHOD} \ |
--pver ${METHOD} \ |
346 |
--pbuild ${METHOD})" |
--pbuild ${METHOD})" |
347 |
|
|
348 |
echo "DEBUG: ${ALLDEPS}" |
install_packages --src-install ${ALLDEPS} || die "src-installing packages" |
349 |
;; |
;; |
350 |
|
|
351 |
search) |
search) |
352 |
${MLIBDIR}/pkgsearch.sh ${MAGENAME} |
pkgsearch "${MAGENAME}" |
353 |
;; |
;; |
354 |
|
|
355 |
unpack) |
unpack) |
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 |