Magellan Linux

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

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

revision 1269 by niro, Tue Apr 26 08:57:30 2011 UTC revision 1780 by niro, Mon Mar 12 23:21:12 2012 UTC
# Line 22  die() Line 22  die()
22   source ${MLIBDIR}/mage4.functions.sh || \   source ${MLIBDIR}/mage4.functions.sh || \
23   die "mage functions missing"   die "mage functions missing"
24    
 ## only for tests -> normally in /etc/rc.d/init.d/functions  
 COLRED="\033[1;6m\033[31m"  
 COLGREEN="\033[1;6m\033[32m"  
 COLYELLOW="\033[1;6m\033[33m"  
 COLBLUE="\033[1;6m\033[34m"  
 COLMAGENTA="\033[1;6m\033[35m"  
 COLWHITE="\033[1;6m\033[37m"  
 COLGRAY="\033[0;6m\033[37m"  
 COLBOLD="\033[1m"  
 COLDEFAULT="\033[0m"  
   
 if [[ ${NOCOLORS} = true ]]  
 then  
  COLRED=""  
  COLGREEN=""  
  COLYELLOW=""  
  COLBLUE=""  
  COLMAGENTA=""  
  COLWHITE=""  
  COLGRAY=""  
  COLBOLD=""  
  COLDEFAULT=""  
 fi  
   
25  # export default path  # export default path
26  export PATH="${PATH}:${MLIBDIR}"  export PATH="${PATH}:${MLIBDIR}"
27    
# Line 93  print_usage() Line 69  print_usage()
69   echo "    clean           - removes *all* downloaded packages"   echo "    clean           - removes *all* downloaded packages"
70   echo "    unpack          - unpacks *all* needed package for 'foo'"   echo "    unpack          - unpacks *all* needed package for 'foo'"
71   echo "    download        - downloads *all* needed packages for 'foo'"   echo "    download        - downloads *all* needed packages for 'foo'"
72     echo "    print-features  - prints all enabled mage-features"
73   echo "    version         - prints version info"   echo "    version         - prints version info"
74   echo "    regen-mage-tree - regenerates the whole mage database (for devs only)"   echo "    regen-mage-tree - regenerates the whole mage database (for devs only)"
75   echo   echo
# Line 118  echo Line 95  echo
95  # install method  # install method
96  METHOD="$1"  METHOD="$1"
97    
98  # initial unversionized packagename, gets overridden later  # initial unversionized packagename, gets overridden later on
99  MAGENAME="$2"  MAGENAME="$2"
100    
101  if [[ ${METHOD} != upgrade ]] && \  if [[ ${METHOD} != upgrade ]] &&
102   [[ ${METHOD} != srcupgrade ]] && \   [[ ${METHOD} != srcupgrade ]] &&
103   [[ ${METHOD} != uppretend ]] && \   [[ ${METHOD} != uppretend ]] &&
104   [[ ${METHOD} != srcuppretend ]] && \   [[ ${METHOD} != srcuppretend ]] &&
105   [[ ${METHOD} != update ]] && \   [[ ${METHOD} != update ]] &&
106   [[ ${METHOD} != update-tarball ]] && \   [[ ${METHOD} != update-tarball ]] &&
107   [[ ${METHOD} != clean ]] && \   [[ ${METHOD} != clean ]] &&
108   [[ ${METHOD} != version ]] && \   [[ ${METHOD} != version ]] &&
109   [[ ${METHOD} != search ]] && \   [[ ${METHOD} != search ]] &&
110   [[ ${METHOD} != regen-mage-tree ]]   [[ ${METHOD} != regen-mage-tree ]] &&
111     [[ ${METHOD} != print-features ]]
112  then  then
113   [[ -z ${METHOD} ]] || [[ -z ${MAGENAME} ]] && print_usage && exit 1   [[ -z ${METHOD} ]] || [[ -z ${MAGENAME} ]] && print_usage && exit 1
114  fi  fi
# Line 145  fi Line 123  fi
123  # before anything run mage_setup  # before anything run mage_setup
124  mage_setup || die "error in mage_setup()"  mage_setup || die "error in mage_setup()"
125    
126    # load supported mage features
127    load_mage_features
128    
129  case ${METHOD} in  case ${METHOD} in
130   download)   download)
131   # 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 242  case ${METHOD} in Line 223  case ${METHOD} in
223   ;;   ;;
224    
225   install)   install)
226     have_root_privileges || die "You must be root to run this operation."
227    
228   # first of all get the right pkg which going to be installed   # first of all get the right pkg which going to be installed
229   PCAT="$(pname2pcat ${MAGENAME})"   PCAT="$(pname2pcat ${MAGENAME})"
230    
# Line 284  case ${METHOD} in Line 267  case ${METHOD} in
267   ;;   ;;
268    
269   srcinstall)   srcinstall)
270     have_root_privileges || die "You must be root to run this operation."
271    
272   # first of all get the right pkg which going to be installed   # first of all get the right pkg which going to be installed
273   PCAT="$(pname2pcat ${MAGENAME})"   PCAT="$(pname2pcat ${MAGENAME})"
274    
# Line 322  case ${METHOD} in Line 307  case ${METHOD} in
307   ;;   ;;
308    
309   uninstall)   uninstall)
310   ALLDEPS="$(get_uninstall_candidates --pname ${MAGENAME})"   have_root_privileges || die "You must be root to run this operation."
311   if [ -z "${ALLDEPS}" ]  
312   then   ALLDEPS="$(get_uninstall_candidates --pname ${MAGENAME})"
313   die "No package installed named '${MAGENAME}'."   if [ -z "${ALLDEPS}" ]
314   fi   then
315   uninstall_packages ${ALLDEPS}   die "No package installed named '${MAGENAME}'."
316     fi
317     uninstall_packages ${ALLDEPS}
318   ;;   ;;
319    
320   uppretend|srcuppretend)   uppretend|srcuppretend)
# Line 340  case ${METHOD} in Line 327  case ${METHOD} in
327   ;;   ;;
328    
329   upgrade)   upgrade)
330     have_root_privileges || die "You must be root to run this operation."
331    
332   # get all dependencies of *all* installed packages   # get all dependencies of *all* installed packages
333   # fake pcat,pname,pver,pbuild ...   # fake pcat,pname,pver,pbuild ...
334   ALLDEPS="$(${MLIBDIR}/depwalker.sh \   ALLDEPS="$(${MLIBDIR}/depwalker.sh \
# Line 357  case ${METHOD} in Line 346  case ${METHOD} in
346   ;;   ;;
347    
348   srcupgrade)   srcupgrade)
349     have_root_privileges || die "You must be root to run this operation."
350    
351   # get all dependencies of *all* installed packages   # get all dependencies of *all* installed packages
352   # fake pcat,pname,pver,pbuild ...   # fake pcat,pname,pver,pbuild ...
353   ALLDEPS="$(${MLIBDIR}/depwalker.sh \   ALLDEPS="$(${MLIBDIR}/depwalker.sh \
# Line 374  case ${METHOD} in Line 365  case ${METHOD} in
365   ;;   ;;
366    
367   unpack)   unpack)
368     have_root_privileges || die "You must be root to run this operation."
369    
370   # first of all get the right pkg which going to be installed   # first of all get the right pkg which going to be installed
371   PCAT="$(pname2pcat ${MAGENAME})"   PCAT="$(pname2pcat ${MAGENAME})"
372    
# Line 405  case ${METHOD} in Line 398  case ${METHOD} in
398   ;;   ;;
399    
400   update)   update)
401     have_root_privileges || die "You must be root to run this operation."
402   syncmage   syncmage
403   ;;   ;;
404    
405   update-tarball)   update-tarball)
406     have_root_privileges || die "You must be root to run this operation."
407   syncmage_tarball   syncmage_tarball
408   ;;   ;;
409    
410   clean)   clean)
411     have_root_privileges || die "You must be root to run this operation."
412   cleanpkg   cleanpkg
413   ;;   ;;
414    
# Line 422  case ${METHOD} in Line 418  case ${METHOD} in
418   ;;   ;;
419    
420   regen-mage-tree)   regen-mage-tree)
421     have_root_privileges || die "You must be root to run this operation."
422    
423   if [ -z "${SMAGESCRIPTSDIR}" ] || [ ! -d "${SMAGESCRIPTSDIR}" ]   if [ -z "${SMAGESCRIPTSDIR}" ] || [ ! -d "${SMAGESCRIPTSDIR}" ]
424   then   then
425   echo "SMAGESCRIPTSDIR not found. Check your mage.rc or check out smage repos."   echo "SMAGESCRIPTSDIR not found. Check your mage.rc or check out smage repos."
# Line 433  case ${METHOD} in Line 431  case ${METHOD} in
431   done   done
432   ;;   ;;
433    
434     print-features)
435     mprintfeatures
436     ;;
437    
438   *)   *)
439   print_usage   print_usage
440   ;;   ;;

Legend:
Removed from v.1269  
changed lines
  Added in v.1780