Magellan Linux

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

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

revision 286 by niro, Thu Dec 1 12:38:45 2005 UTC revision 329 by niro, Thu Feb 16 22:11:06 2006 UTC
# Line 1  Line 1 
1  #!/bin/bash  #!/bin/bash
2  # Magellan Linux Installer Functions (mage.functions.sh)  # Magellan Linux Installer Functions (mage.functions.sh)
3  # $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/mage4.functions.sh,v 1.10 2005-12-01 12:38:45 niro Exp $  # $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/mage4.functions.sh,v 1.16 2006-02-16 22:11:06 niro Exp $
4    
5  mage_setup()  mage_setup()
6  {  {
# Line 361  install_characterdevices() Line 361  install_characterdevices()
361   local pkgname="$1"   local pkgname="$1"
362   local pathto   local pathto
363   local posix   local posix
364     local major
365     local minor
366   local IFS   local IFS
367    
368   # sanity checks; abort if not given   # sanity checks; abort if not given
# Line 374  install_characterdevices() Line 376  install_characterdevices()
376   # sets fieldseperator to "§" instead of " "   # sets fieldseperator to "§" instead of " "
377   IFS=§   IFS=§
378    
379   while read pathto posix   while read pathto posix major minor
380   do   do
381   [ -z "${pathto}" ] && continue   [ -z "${pathto}" ] && continue
382   [[ ${VERBOSE} = on ]] && echo -e "\t>>> CHAR: ${MROOT}${pathto}"   [[ ${VERBOSE} = on ]] && echo -e "\t>>> CHAR: ${MROOT}${pathto}"
383    
384   mknode -m ${posix} -c "${MROOT}${pathto}"   mknod -m ${posix} "${MROOT}${pathto}" c ${major} ${minor}
385   done < ${BUILDDIR}/${pkgname}/.char   done < ${BUILDDIR}/${pkgname}/.char
386    
387   # very important: unsetting the '§' fieldseperator   # very important: unsetting the '§' fieldseperator
# Line 556  remove_database_entry() Line 558  remove_database_entry()
558   # abort if mage file not exists   # abort if mage file not exists
559   [ ! -f ${magefile} ] && die "remove_database_entry() ${magefile} not exist."   [ ! -f ${magefile} ] && die "remove_database_entry() ${magefile} not exist."
560    
561   # first unregister virtuals   # remove virtuals only if no other exist
562   provide="$(get_value_from_magefile PROVIDE ${magefile})"   if [[ $(count_installed_pkgs --pcat ${pcat} --pname ${pname}) -le 1 ]]
  if [ -n "${provide}" ]  
563   then   then
564   for i in ${provide}   # first unregister virtuals
565   do   provide="$(get_value_from_magefile PROVIDE ${magefile})"
566   virtuals_del "${i}" "${pcat}/${pname}"   if [ -n "${provide}" ]
567   done   then
568     for i in ${provide}
569     do
570     virtuals_del "${i}" "${pcat}/${pname}"
571     done
572     fi
573   fi   fi
574    
575   # removes database entry   # removes database entry
# Line 573  remove_database_entry() Line 579  remove_database_entry()
579   fi   fi
580  }  }
581    
582    # get the number of installed packages
583    count_installed_pkgs()
584    {
585     local pcat
586     local pname
587     local pkg
588     local i
589    
590     # very basic getops
591     for i in $*
592     do
593     case $1 in
594     --pcat|-c) shift; pcat="$1" ;;
595     --pname|-n) shift; pname="$1" ;;
596     esac
597     shift
598     done
599    
600     # sanity checks; abort if not given
601     [ -z "${pcat}" ] && die "pkg_count() \$pcat not given."
602     [ -z "${pname}" ] && die "pkg_count() \$pname not given."
603    
604     declare -i i=0
605     for pkg in $(get_uninstall_candidates --pcat ${pcat} --pname ${pname})
606     do
607     (( i++ ))
608     #echo "$i ${pkg}"
609     done
610    
611     # return the value
612     echo "${i}"
613    }
614    
615    
616  ###################################################  ###################################################
617  # function compare_mtime                          #  # function compare_mtime                          #
# Line 1429  get_uninstall_candidates() Line 1468  get_uninstall_candidates()
1468   shift   shift
1469   done   done
1470    
1471   # sanity checks; abort if not given  # it's not good to complain here about empty pnames; better to continue later anyway
1472   [ -z "${search_pname}" ] && die "get_uninstall_candidates() \$search_pname not given."  # # sanity checks; abort if not given
1473    # [ -z "${search_pname}" ] && die "get_uninstall_candidates() \$search_pname not given."
1474    
1475    
1476   # check needed global vars   # check needed global vars
1477   [ -z "${INSTALLDB}" ] && die "get_uninstall_candidates() \$INSTALLDB not set."   [ -z "${INSTALLDB}" ] && die "get_uninstall_candidates() \$INSTALLDB not set."
1478    
1479   # set pcatdir to '*' if empty   # set pcatdir to '*' if empty
1480   [ -z "${pcatdir}" ] && pcatdir=*   [ -z "${pcatdir}" ] && pcatdir='*'
1481    
1482   for pkg in ${MROOT}${INSTALLDB}/${pcatdir}/*   for pkg in ${MROOT}${INSTALLDB}/${pcatdir}/*
1483   do   do
# Line 1526  virtuals_add() Line 1566  virtuals_add()
1566    
1567   if virtuals_read ${virtualname}   if virtuals_read ${virtualname}
1568   then   then
1569   # make shure ${PKG_NAME} is *not* in ${VIRTUAL_NAME} already   # make sure ${PKG_NAME} is *not* in ${VIRTUAL_NAME} already
1570   for i in $(virtuals_read ${virtualname} showpkgs)   for i in $(virtuals_read ${virtualname} showpkgs)
1571   do   do
1572   if [[ ${i} = ${pkgname} ]]   if [[ ${i} = ${pkgname} ]]
# Line 2502  pkgsearch() Line 2542  pkgsearch()
2542   local ipbuild   local ipbuild
2543    
2544   # only names no versions   # only names no versions
2545   result="$(find ${MAGEDIR} -mindepth 2 -maxdepth 2 -type d -name *${string}*)"   result="$(find ${MAGEDIR} -mindepth 2 -maxdepth 2 -type d -name '*'${string}'*')"
2546   #result="$(find ${MAGEDIR} -type f -name *${string}*.mage | sort)"   #result="$(find ${MAGEDIR} -type f -name '*'${string}'*'.mage | sort)"
2547    
2548   # nothing found   # nothing found
2549   [[ -z ${result} ]] && die "No package found containing '${string}' in the name."   [[ -z ${result} ]] && die "No package found containing '${string}' in the name."

Legend:
Removed from v.286  
changed lines
  Added in v.329