Magellan Linux

Diff of /trunk/mage/usr/lib/mage/mage4.sh

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

revision 247 by niro, Tue Sep 27 14:36:57 2005 UTC revision 299 by niro, Sun Dec 4 17:12:07 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.7 2005-09-27 14:36:57 niro Exp $  # $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/mage4.sh,v 1.11 2005-12-04 17:12:07 niro Exp $
4    
5  # default die function  # default die function
6  die()  die()
# Line 21  die() Line 21  die()
21   source ${MLIBDIR}/mage4.functions.sh || \   source ${MLIBDIR}/mage4.functions.sh || \
22   die "mage functions missing"   die "mage functions missing"
23    
 # for tests only  
 #source /home/tjoke/alx-cvs/magellan-src/mage/usr/lib/mage/mage.rc.global  
 #source /etc/mage.rc  
 #source /home/tjoke/alx-cvs/magellan-src/mage/usr/lib/mage/mage4.functions.sh  
 #MLIBDIR=/home/tjoke/alx-cvs/magellan-src/mage/usr/lib/mage  
   
24  ## only for tests -> normally in /etc/rc.d/init.d/functions  ## only for tests -> normally in /etc/rc.d/init.d/functions
25  COLRED="\033[1;6m\033[31m"  COLRED="\033[1;6m\033[31m"
26  COLGREEN="\033[1;6m\033[32m"  COLGREEN="\033[1;6m\033[32m"
# Line 69  then Line 63  then
63  fi  fi
64    
65  # default messages  # default messages
66  showversion() {  showversion()
67    {
68   local MAGEVERSION="$(< ${MLIBDIR}/version)"   local MAGEVERSION="$(< ${MLIBDIR}/version)"
69    
70   echo -en "Magellan Package Manager v${MAGEVERSION} "   echo -en "Magellan Package Manager v${MAGEVERSION} "
71   echo -e  "-- Niels Rogalla (niro@magellan-linux.de)"   echo -e  "-- Niels Rogalla (niro@magellan-linux.de)"
72  }  }
73    
74  print_usage(){  print_usage()
75   showversion  {
76   echo   #showversion
77     #echo
78   echo "Usage: $(basename $0) [option] pkgname ..."   echo "Usage: $(basename $0) [option] pkgname ..."
79   echo "Options:"   echo "Options:"
80   echo "     pretend        - pretends dependencies of a package"   echo "    pretend         - pretends dependencies of a package"
81   echo "     srcpretend     - pretends dependencies of a package (build from source)"   echo "    srcpretend      - pretends dependencies of a package (build from source)"
82   echo "     install        - installs a package"   echo "    install         - installs a package"
83   echo "     srcinstall     - installs a package from source"   echo "    srcinstall      - installs a package from source"
84   echo "     uninstall      - removes a package"   echo "    uninstall       - removes a package"
85   echo "     update         - updates mage-tree"   echo "    update          - updates mage-tree"
86   echo "     uppretend      - pretend dependencies for a system upgrade"   echo "    uppretend       - pretend dependencies for a system upgrade"
87   echo "     upgrade        - runs a complete system upgrade"   echo "    upgrade         - runs a complete system upgrade"
88   echo "     srcuppretend   - pretend dependencies for a system upgrade from source"   echo "    srcuppretend    - pretend dependencies for a system upgrade from source"
89   echo "     srcupgrade     - runs a complete system upgrade from source"   echo "    srcupgrade      - runs a complete system upgrade from source"
90   echo "     search         - searches mage-tree for a package"   echo "    search          - searches mage-tree for a package"
91   echo "     clean          - removes *all* downloaded packages"   echo "    clean           - removes *all* downloaded packages"
92   echo "     unpack         - unpacks *all* needed package for 'foo'"   echo "    unpack          - unpacks *all* needed package for 'foo'"
93   echo "     download       - downloads *all* needed packages for 'foo'"   echo "    download        - downloads *all* needed packages for 'foo'"
94   echo "     version        - prints version info"   echo "    version         - prints version info"
95     echo "    regen-mage-tree - regenerates the whole mage database (for devs only)"
96   echo   echo
97   echo "Other options:"   echo "Other options:"
98  # echo "NOINSTALL=yes $(basename $0) srcinstall PACKAGE"  # echo "NOINSTALL=yes $(basename $0) srcinstall PACKAGE"
99  # echo "Builds a Package with its dependencies, but won't install anything."  # echo "Builds a Package with its dependencies, but won't install anything."
100  # echo  # echo
101   echo "USE_UNSTABLE=true $(basename $0) [src]install PACKAGE"   echo "MAGE_DISTRIBUTION=unstable $(basename $0) [src]install PACKAGE"
102   echo "Overrides stable packages; you can install packages that are marked unstable."   echo "Overrides stable packages; you can install packages that are marked unstable."
103   echo   echo
104   echo "USE_TESTING=true $(basename $0) [src]install PACKAGE"   echo "MAGE_DISTRIBUTION=testing $(basename $0) [src]install PACKAGE"
105   echo "Overrides stable packages; you can install packages that are marked testing."   echo "Overrides stable packages; you can install packages that are marked testing."
106   echo   echo
107   echo "NOCOLORS=true $(basename $0) [src]install PACKAGE"   echo "NOCOLORS=true $(basename $0) [src]install PACKAGE"
# Line 138  then Line 135  then
135   [[ -z ${METHOD} ]] || [[ -z ${MAGENAME} ]] && print_usage && exit 1   [[ -z ${METHOD} ]] || [[ -z ${MAGENAME} ]] && print_usage && exit 1
136  fi  fi
137    
138    # set PKGDIR and BUILDDIR to MROOT
139    if [[ -n ${MROOT} ]]
140    then
141     PKGDIR=${MROOT}/${PKGDIR}
142     BUILDDIR=${MROOT}/${BUILDDIR}
143    fi
144    
145  case ${METHOD} in  case ${METHOD} in
146   download)   download)
# Line 148  case ${METHOD} in Line 151  case ${METHOD} in
151   [ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist."   [ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist."
152    
153   # source the highest magefile of this pkg   # source the highest magefile of this pkg
154   source $(get_highest_magefile ${PCAT} ${MAGENAME})   PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME}))
155    
156   # convert PKGNAME to PNAME/PVER/PBUILD   # convert PKGNAME to PNAME/PVER/PBUILD
157   # 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 178  case ${METHOD} in
178   [ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist."   [ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist."
179    
180   # source the highest magefile of this pkg   # source the highest magefile of this pkg
181   source $(get_highest_magefile ${PCAT} ${MAGENAME})   PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME}))
182    
183   # convert PKGNAME to PNAME/PVER/PBUILD   # convert PKGNAME to PNAME/PVER/PBUILD
184   # 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 204  case ${METHOD} in
204   [ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist."   [ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist."
205    
206   # source the highest magefile of this pkg   # source the highest magefile of this pkg
207   source $(get_highest_magefile ${PCAT} ${MAGENAME})   PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME}))
208    
209   # convert PKGNAME to PNAME/PVER/PBUILD   # convert PKGNAME to PNAME/PVER/PBUILD
210   # 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 237  case ${METHOD} in
237   [ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist."   [ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist."
238    
239   # source the highest magefile of this pkg   # source the highest magefile of this pkg
240   source $(get_highest_magefile ${PCAT} ${MAGENAME})   PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME}))
241    
242   # convert PKGNAME to PNAME/PVER/PBUILD   # convert PKGNAME to PNAME/PVER/PBUILD
243   # we're working *only* with these three vars from here on   # we're working *only* with these three vars from here on
# Line 273  case ${METHOD} in Line 276  case ${METHOD} in
276   [ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist."   [ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist."
277    
278   # source the highest magefile of this pkg   # source the highest magefile of this pkg
279   source $(get_highest_magefile ${PCAT} ${MAGENAME})   PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME}))
280    
281   # convert PKGNAME to PNAME/PVER/PBUILD   # convert PKGNAME to PNAME/PVER/PBUILD
282   # we're working *only* with these three vars from here on   # we're working *only* with these three vars from here on
# Line 360  case ${METHOD} in Line 363  case ${METHOD} in
363   [ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist."   [ -z "${PCAT}" ] && die "Package '${MAGENAME}' does not exist."
364    
365   # source the highest magefile of this pkg   # source the highest magefile of this pkg
366   source $(get_highest_magefile ${PCAT} ${MAGENAME})   PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME}))
367    
368   # convert PKGNAME to PNAME/PVER/PBUILD   # convert PKGNAME to PNAME/PVER/PBUILD
369   # we're working *only* with these three vars from here on   # we're working *only* with these three vars from here on
# Line 389  case ${METHOD} in Line 392  case ${METHOD} in
392   ;;   ;;
393    
394   version)   version)
395   showversion   # showversion
396     exit 0
397   ;;   ;;
398    
399   regen-mage-tree)   regen-mage-tree)

Legend:
Removed from v.247  
changed lines
  Added in v.299