Magellan Linux

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

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

revision 739 by niro, Mon Jun 16 09:29:57 2008 UTC revision 1584 by niro, Wed Dec 28 12:23:50 2011 UTC
# Line 1  Line 1 
1  #!/bin/sh  #!/bin/bash
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.17 2008-06-16 09:29:57 niro Exp $  # $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/mage4.sh,v 1.17 2008-06-16 09:29:57 niro Exp $
4    
# 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 55  export LC_ALL=C Line 31  export LC_ALL=C
31  # sanity checks  # sanity checks
32  [ ! -e ${VIRTUALDB_FILE} ] && touch ${VIRTUALDB_FILE}  [ ! -e ${VIRTUALDB_FILE} ] && touch ${VIRTUALDB_FILE}
33    
34  if [ ! -e ${VIRTUALDB_DEFAULTS} ] && [[ $1 != update ]]  if [ ! -e ${VIRTUALDB_DEFAULTS} ] && [[ $1 != update ]] && [[ $1 != update-tarball ]]
35  then  then
36   echo   echo
37   echo "Please choose an profile from the mage tree."   echo "Please choose an profile from the mage tree."
# Line 118  echo Line 94  echo
94  # install method  # install method
95  METHOD="$1"  METHOD="$1"
96    
97  # initial unversionized packagename, gets overridden later  # initial unversionized packagename, gets overridden later on
98  MAGENAME="$2"  MAGENAME="$2"
99    
100  if [[ ${METHOD} != upgrade ]] && \  if [[ ${METHOD} != upgrade ]] && \
# Line 145  fi Line 121  fi
121  # before anything run mage_setup  # before anything run mage_setup
122  mage_setup || die "error in mage_setup()"  mage_setup || die "error in mage_setup()"
123    
124    # load supported mage features
125    load_mage_features
126    
127  case ${METHOD} in  case ${METHOD} in
128   download)   download)
129   # 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 221  case ${METHOD} in
221   ;;   ;;
222    
223   install)   install)
224     have_root_privileges || die "You must be root to run this operation."
225    
226   # first of all get the right pkg which going to be installed   # first of all get the right pkg which going to be installed
227   PCAT="$(pname2pcat ${MAGENAME})"   PCAT="$(pname2pcat ${MAGENAME})"
228    
# Line 284  case ${METHOD} in Line 265  case ${METHOD} in
265   ;;   ;;
266    
267   srcinstall)   srcinstall)
268     have_root_privileges || die "You must be root to run this operation."
269    
270   # first of all get the right pkg which going to be installed   # first of all get the right pkg which going to be installed
271   PCAT="$(pname2pcat ${MAGENAME})"   PCAT="$(pname2pcat ${MAGENAME})"
272    
# Line 322  case ${METHOD} in Line 305  case ${METHOD} in
305   ;;   ;;
306    
307   uninstall)   uninstall)
308   ALLDEPS="$(get_uninstall_candidates --pname ${MAGENAME})"   have_root_privileges || die "You must be root to run this operation."
309   if [ -z "${ALLDEPS}" ]  
310   then   ALLDEPS="$(get_uninstall_candidates --pname ${MAGENAME})"
311   die "No package installed named '${MAGENAME}'."   if [ -z "${ALLDEPS}" ]
312   fi   then
313   uninstall_packages ${ALLDEPS}   die "No package installed named '${MAGENAME}'."
314     fi
315     uninstall_packages ${ALLDEPS}
316   ;;   ;;
317    
318   uppretend|srcuppretend)   uppretend|srcuppretend)
# Line 340  case ${METHOD} in Line 325  case ${METHOD} in
325   ;;   ;;
326    
327   upgrade)   upgrade)
328     have_root_privileges || die "You must be root to run this operation."
329    
330   # get all dependencies of *all* installed packages   # get all dependencies of *all* installed packages
331   # fake pcat,pname,pver,pbuild ...   # fake pcat,pname,pver,pbuild ...
332   ALLDEPS="$(${MLIBDIR}/depwalker.sh \   ALLDEPS="$(${MLIBDIR}/depwalker.sh \
# Line 357  case ${METHOD} in Line 344  case ${METHOD} in
344   ;;   ;;
345    
346   srcupgrade)   srcupgrade)
347     have_root_privileges || die "You must be root to run this operation."
348    
349   # get all dependencies of *all* installed packages   # get all dependencies of *all* installed packages
350   # fake pcat,pname,pver,pbuild ...   # fake pcat,pname,pver,pbuild ...
351   ALLDEPS="$(${MLIBDIR}/depwalker.sh \   ALLDEPS="$(${MLIBDIR}/depwalker.sh \
# Line 374  case ${METHOD} in Line 363  case ${METHOD} in
363   ;;   ;;
364    
365   unpack)   unpack)
366     have_root_privileges || die "You must be root to run this operation."
367    
368   # first of all get the right pkg which going to be installed   # first of all get the right pkg which going to be installed
369   PCAT="$(pname2pcat ${MAGENAME})"   PCAT="$(pname2pcat ${MAGENAME})"
370    
# Line 405  case ${METHOD} in Line 396  case ${METHOD} in
396   ;;   ;;
397    
398   update)   update)
399     have_root_privileges || die "You must be root to run this operation."
400   syncmage   syncmage
401   ;;   ;;
402    
403   update-tarball)   update-tarball)
404     have_root_privileges || die "You must be root to run this operation."
405   syncmage_tarball   syncmage_tarball
406   ;;   ;;
407    
408   clean)   clean)
409     have_root_privileges || die "You must be root to run this operation."
410   cleanpkg   cleanpkg
411   ;;   ;;
412    
# Line 422  case ${METHOD} in Line 416  case ${METHOD} in
416   ;;   ;;
417    
418   regen-mage-tree)   regen-mage-tree)
419     have_root_privileges || die "You must be root to run this operation."
420    
421   if [ -z "${SMAGESCRIPTSDIR}" ] || [ ! -d "${SMAGESCRIPTSDIR}" ]   if [ -z "${SMAGESCRIPTSDIR}" ] || [ ! -d "${SMAGESCRIPTSDIR}" ]
422   then   then
423   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."

Legend:
Removed from v.739  
changed lines
  Added in v.1584