Magellan Linux

Diff of /branches/mage-next/usr/lib/mage/mage4.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 230 by niro, Fri Sep 9 17:49:43 2005 UTC revision 254 by niro, Mon Oct 3 13:48:06 2005 UTC
# Line 1  Line 1 
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.2 2005-09-09 17:49:43 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()
# Line 10  die() Line 10  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
25  source /home/tjoke/alx-cvs/magellan-src/mage/usr/lib/mage/mage.rc.global  #source /home/tjoke/alx-cvs/magellan-src/mage/usr/lib/mage/mage.rc.global
26  source /etc/mage.rc  #source /etc/mage.rc
27  source /home/tjoke/alx-cvs/magellan-src/mage/usr/lib/mage/mage4.functions.sh  #source /home/tjoke/alx-cvs/magellan-src/mage/usr/lib/mage/mage4.functions.sh
28  MLIBDIR=/home/tjoke/alx-cvs/magellan-src/mage/usr/lib/mage  #MLIBDIR=/home/tjoke/alx-cvs/magellan-src/mage/usr/lib/mage
29    
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 ]]
# Line 41  then Line 46  then
46   COLBLUE=""   COLBLUE=""
47   COLMAGENTA=""   COLMAGENTA=""
48   COLWHITE=""   COLWHITE=""
49     COLGRAY=""
50     COLBOLD=""
51   COLDEFAULT=""   COLDEFAULT=""
52  fi  fi
53    
# Line 121  MAGENAME="$2" Line 128  MAGENAME="$2"
128  if [[ ${METHOD} != upgrade ]] && \  if [[ ${METHOD} != upgrade ]] && \
129   [[ ${METHOD} != srcupgrade ]] && \   [[ ${METHOD} != srcupgrade ]] && \
130   [[ ${METHOD} != uppretend ]] && \   [[ ${METHOD} != uppretend ]] && \
131   [[ ${METHOD} != srcuppretend ]]   [[ ${METHOD} != srcuppretend ]] && \
132     [[ ${METHOD} != update ]] && \
133     [[ ${METHOD} != clean ]] && \
134     [[ ${METHOD} != version ]] && \
135     [[ ${METHOD} != search ]] && \
136     [[ ${METHOD} != regen-mage-tree ]]
137  then  then
138   [[ -z ${METHOD} ]] || [[ -z ${MAGENAME} ]] && print_usage && exit 1   [[ -z ${METHOD} ]] || [[ -z ${MAGENAME} ]] && print_usage && exit 1
139  fi  fi
# Line 136  case ${METHOD} in Line 148  case ${METHOD} in
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
# Line 163  case ${METHOD} in Line 175  case ${METHOD} in
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
# Line 189  case ${METHOD} in Line 201  case ${METHOD} in
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
# Line 222  case ${METHOD} in Line 234  case ${METHOD} in
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
# Line 233  case ${METHOD} in Line 245  case ${METHOD} in
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
# Line 261  case ${METHOD} in Line 273  case ${METHOD} in
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
# Line 272  case ${METHOD} in Line 284  case ${METHOD} in
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
# Line 306  case ${METHOD} in Line 318  case ${METHOD} in
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 \
# Line 316  case ${METHOD} in Line 345  case ${METHOD} in
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)
# Line 330  case ${METHOD} in Line 360  case ${METHOD} in
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

Legend:
Removed from v.230  
changed lines
  Added in v.254