Magellan Linux

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

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

revision 280 by niro, Fri Oct 21 16:01:40 2005 UTC revision 310 by niro, Sun Jan 1 22:59:52 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.9 2005-10-21 16:01:40 niro Exp $  # $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/mage4.functions.sh,v 1.12 2006-01-01 22:59:52 niro Exp $
4    
5  mage_setup()  mage_setup()
6  {  {
# Line 379  install_characterdevices() Line 379  install_characterdevices()
379   [ -z "${pathto}" ] && continue   [ -z "${pathto}" ] && continue
380   [[ ${VERBOSE} = on ]] && echo -e "\t>>> CHAR: ${MROOT}${pathto}"   [[ ${VERBOSE} = on ]] && echo -e "\t>>> CHAR: ${MROOT}${pathto}"
381    
382   mknode -m ${posix} -c "${MROOT}${pathto}"   mknod -m ${posix} -c "${MROOT}${pathto}"
383   done < ${BUILDDIR}/${pkgname}/.char   done < ${BUILDDIR}/${pkgname}/.char
384    
385   # very important: unsetting the '§' fieldseperator   # very important: unsetting the '§' fieldseperator
# Line 556  remove_database_entry() Line 556  remove_database_entry()
556   # abort if mage file not exists   # abort if mage file not exists
557   [ ! -f ${magefile} ] && die "remove_database_entry() ${magefile} not exist."   [ ! -f ${magefile} ] && die "remove_database_entry() ${magefile} not exist."
558    
559   # first unregister virtuals   # remove virtuals only if no other exist
560   provide="$(get_value_from_magefile PROVIDE ${magefile})"   if [[ $(count_installed_pkgs --pcat ${pcat} --pname ${pname}) -le 1 ]]
  if [ -n "${provide}" ]  
561   then   then
562   for i in ${provide}   # first unregister virtuals
563   do   provide="$(get_value_from_magefile PROVIDE ${magefile})"
564   virtuals_del "${i}" "${pcat}/${pname}"   if [ -n "${provide}" ]
565   done   then
566     for i in ${provide}
567     do
568     virtuals_del "${i}" "${pcat}/${pname}"
569     done
570     fi
571   fi   fi
572    
573   # removes database entry   # removes database entry
# Line 573  remove_database_entry() Line 577  remove_database_entry()
577   fi   fi
578  }  }
579    
580    # get the number of installed packages
581    count_installed_pkgs()
582    {
583     local pcat
584     local pname
585     local pkg
586     local i
587    
588     # very basic getops
589     for i in $*
590     do
591     case $1 in
592     --pcat|-c) shift; pcat="$1" ;;
593     --pname|-n) shift; pname="$1" ;;
594     esac
595     shift
596     done
597    
598     # sanity checks; abort if not given
599     [ -z "${pcat}" ] && die "pkg_count() \$pcat not given."
600     [ -z "${pname}" ] && die "pkg_count() \$pname not given."
601    
602     declare -i i=0
603     for pkg in $(get_uninstall_candidates --pcat ${pcat} --pname ${pname})
604     do
605     (( i++ ))
606     #echo "$i ${pkg}"
607     done
608    
609     # return the value
610     echo "${i}"
611    }
612    
613    
614  ###################################################  ###################################################
615  # function compare_mtime                          #  # function compare_mtime                          #
# Line 1119  fetch_packages() Line 1156  fetch_packages()
1156   --continue \   --continue \
1157   --progress bar \   --progress bar \
1158   --directory-prefix=${PKGDIR} \   --directory-prefix=${PKGDIR} \
1159   ${opt} ${mirr}/packages/${pkg}   ${opt} ${mirr}/${PACKAGES_SERVER_PATH}/${pkg}
1160   if [[ $? = 0 ]]   if [[ $? = 0 ]]
1161   then   then
1162   break   break
# Line 1251  check_stable_package() Line 1288  check_stable_package()
1288   STATE="$(get_value_from_magefile STATE "$1")"   STATE="$(get_value_from_magefile STATE "$1")"
1289    
1290   # state testing   # state testing
1291   if [[ ${USE_TESTING} = true ]]   if [[ ${USE_TESTING} = true ]] || [[ ${MAGE_DISTRIBUTION} = testing ]]
1292   then   then
1293   case ${STATE} in   case ${STATE} in
1294   testing|stable) return 0 ;;   testing|stable) return 0 ;;
# Line 1260  check_stable_package() Line 1297  check_stable_package()
1297   fi   fi
1298    
1299   # state unstable   # state unstable
1300   if [[ ${USE_UNSTABLE} = true ]]   if [[ ${USE_UNSTABLE} = true ]] || [[ ${MAGE_DISTRIBUTION} = unstable ]]
1301   then   then
1302   case ${STATE} in   case ${STATE} in
1303   unstable|testing|stable) return 0 ;;   unstable|testing|stable) return 0 ;;

Legend:
Removed from v.280  
changed lines
  Added in v.310