Magellan Linux

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

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

revision 239 by niro, Sun Sep 11 19:46:05 2005 UTC revision 287 by niro, Thu Dec 1 12:40:21 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.6 2005-09-11 19:46:05 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()
# Line 81  print_usage(){ Line 81  print_usage(){
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"
# Line 138  then Line 139  then
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)
# Line 148  case ${METHOD} in Line 155  case ${METHOD} in
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
# Line 175  case ${METHOD} in Line 182  case ${METHOD} in
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
# Line 201  case ${METHOD} in Line 208  case ${METHOD} in
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
# Line 234  case ${METHOD} in Line 241  case ${METHOD} in
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
# Line 245  case ${METHOD} in Line 252  case ${METHOD} in
252   if is_installed ${PCAT}/${PNAME}-${PVER}-${PBUILD}   if is_installed ${PCAT}/${PNAME}-${PVER}-${PBUILD}
253   then   then
254   echo -en "Package "   echo -en "Package "
255   echo -en "${COLRED}${PNAME}-${PVER}-${PBUILD}${COLDEFAULT}"   echo -en "${COLRED}${PCAT}/${PNAME}-${PVER}-${PBUILD}${COLDEFAULT}"
256   echo -e  " already installed."   echo -e  " already installed."
257   exit 3   exit 3
258   fi   fi
# Line 273  case ${METHOD} in Line 280  case ${METHOD} in
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
# Line 284  case ${METHOD} in Line 291  case ${METHOD} in
291   if is_installed ${PCAT}/${PNAME}-${PVER}-${PBUILD}   if is_installed ${PCAT}/${PNAME}-${PVER}-${PBUILD}
292   then   then
293   echo -en "Package "   echo -en "Package "
294   echo -en "${COLRED}${PNAME}-${PVER}-${PBUILD}${COLDEFAULT}"   echo -en "${COLRED}${PCAT}/${PNAME}-${PVER}-${PBUILD}${COLDEFAULT}"
295   echo -e  " already installed."   echo -e  " already installed."
296   exit 3   exit 3
297   fi   fi
# Line 318  case ${METHOD} in Line 325  case ${METHOD} in
325   --pbuild ${METHOD}   --pbuild ${METHOD}
326   ;;   ;;
327    
328   upgrade|srcupgrade)   upgrade)
329   # get all dependencies of *all* installed packages   # get all dependencies of *all* installed packages
330   # fake pcat,pname,pver,pbuild ...   # fake pcat,pname,pver,pbuild ...
331   ALLDEPS="$(${MLIBDIR}/depwalker.sh \   ALLDEPS="$(${MLIBDIR}/depwalker.sh \
# Line 328  case ${METHOD} in Line 335  case ${METHOD} in
335   --pver ${METHOD} \   --pver ${METHOD} \
336   --pbuild ${METHOD})"   --pbuild ${METHOD})"
337    
338   echo "DEBUG: ${ALLDEPS}"   # first fetch all packages
339     fetch_packages ${ALLDEPS} || die "fetching packages"
340     md5sum_packages ${ALLDEPS} || die "md5 sum packages"
341     unpack_packages ${ALLDEPS} || die "unpacking packages"
342     install_packages ${ALLDEPS} || die "installing packages"
343     ;;
344    
345     srcupgrade)
346     # get all dependencies of *all* installed packages
347     # fake pcat,pname,pver,pbuild ...
348     ALLDEPS="$(${MLIBDIR}/depwalker.sh \
349     --method ${METHOD} \
350     --pcat ${METHOD} \
351     --pname ${METHOD} \
352     --pver ${METHOD} \
353     --pbuild ${METHOD})"
354    
355     install_packages --src-install ${ALLDEPS} || die "src-installing packages"
356   ;;   ;;
357    
358   search)   search)
# Line 343  case ${METHOD} in Line 367  case ${METHOD} in
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

Legend:
Removed from v.239  
changed lines
  Added in v.287