Magellan Linux

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

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

revision 287 by niro, Thu Dec 1 12:40:21 2005 UTC revision 372 by niro, Thu Apr 27 14:51:30 2006 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.9 2005-12-01 12:40:21 niro Exp $  # $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/mage4.sh,v 1.14 2006-04-27 14:51:30 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"
# Line 102  print_usage(){ Line 98  print_usage(){
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 117  print_usage(){ Line 113  print_usage(){
113  showversion  showversion
114  echo  echo
115    
 # before anything run mage_setup  
 mage_setup || die "error in mage_setup()"  
   
116  # install method  # install method
117  METHOD="$1"  METHOD="$1"
118    
# Line 146  then Line 139  then
139   BUILDDIR=${MROOT}/${BUILDDIR}   BUILDDIR=${MROOT}/${BUILDDIR}
140  fi  fi
141    
142    # before anything run mage_setup
143    mage_setup || die "error in mage_setup()"
144    
145  case ${METHOD} in  case ${METHOD} in
146   download)   download)
147   # first of all get the right pkg which going to be installed   # first of all get the right pkg which going to be installed
# Line 157  case ${METHOD} in Line 153  case ${METHOD} in
153   # source the highest magefile of this pkg   # source the highest magefile of this pkg
154   PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME}))   PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME}))
155    
156     # package is masked
157     [ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation."
158    
159   # convert PKGNAME to PNAME/PVER/PBUILD   # convert PKGNAME to PNAME/PVER/PBUILD
160   # we're working *only* with these three vars from here on   # we're working *only* with these three vars from here on
161   PNAME="$(pkgname2pname ${PKGNAME})"   PNAME="$(pkgname2pname ${PKGNAME})"
# Line 184  case ${METHOD} in Line 183  case ${METHOD} in
183   # source the highest magefile of this pkg   # source the highest magefile of this pkg
184   PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME}))   PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME}))
185    
186     # package is masked
187     [ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation."
188    
189   # convert PKGNAME to PNAME/PVER/PBUILD   # convert PKGNAME to PNAME/PVER/PBUILD
190   # we're working *only* with these three vars from here on   # we're working *only* with these three vars from here on
191   PNAME="$(pkgname2pname ${PKGNAME})"   PNAME="$(pkgname2pname ${PKGNAME})"
# Line 210  case ${METHOD} in Line 212  case ${METHOD} in
212   # source the highest magefile of this pkg   # source the highest magefile of this pkg
213   PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME}))   PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME}))
214    
215     # package is masked
216     [ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation."
217    
218   # convert PKGNAME to PNAME/PVER/PBUILD   # convert PKGNAME to PNAME/PVER/PBUILD
219   # we're working *only* with these three vars from here on   # we're working *only* with these three vars from here on
220   PNAME="$(pkgname2pname ${PKGNAME})"   PNAME="$(pkgname2pname ${PKGNAME})"
# Line 243  case ${METHOD} in Line 248  case ${METHOD} in
248   # source the highest magefile of this pkg   # source the highest magefile of this pkg
249   PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME}))   PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME}))
250    
251     # package is masked
252     [ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation."
253    
254   # convert PKGNAME to PNAME/PVER/PBUILD   # convert PKGNAME to PNAME/PVER/PBUILD
255   # we're working *only* with these three vars from here on   # we're working *only* with these three vars from here on
256   PNAME="$(pkgname2pname ${PKGNAME})"   PNAME="$(pkgname2pname ${PKGNAME})"
# Line 282  case ${METHOD} in Line 290  case ${METHOD} in
290   # source the highest magefile of this pkg   # source the highest magefile of this pkg
291   PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME}))   PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME}))
292    
293     # package is masked
294     [ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation."
295    
296   # convert PKGNAME to PNAME/PVER/PBUILD   # convert PKGNAME to PNAME/PVER/PBUILD
297   # we're working *only* with these three vars from here on   # we're working *only* with these three vars from here on
298   PNAME="$(pkgname2pname ${PKGNAME})"   PNAME="$(pkgname2pname ${PKGNAME})"
# Line 369  case ${METHOD} in Line 380  case ${METHOD} in
380   # source the highest magefile of this pkg   # source the highest magefile of this pkg
381   PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME}))   PKGNAME=$(get_value_from_magefile PKGNAME $(get_highest_magefile ${PCAT} ${MAGENAME}))
382    
383     # package is masked
384     [ -z "${PKGNAME}" ] && die "Package '${MAGENAME}' is masked and not available for installation."
385    
386   # convert PKGNAME to PNAME/PVER/PBUILD   # convert PKGNAME to PNAME/PVER/PBUILD
387   # we're working *only* with these three vars from here on   # we're working *only* with these three vars from here on
388   PNAME="$(pkgname2pname ${PKGNAME})"   PNAME="$(pkgname2pname ${PKGNAME})"
# Line 396  case ${METHOD} in Line 410  case ${METHOD} in
410   ;;   ;;
411    
412   version)   version)
413   showversion   # showversion
414     exit 0
415   ;;   ;;
416    
417   regen-mage-tree)   regen-mage-tree)

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