Magellan Linux

Diff of /branches/mage-next/src/mage4.functions.sh

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

revision 273 by niro, Fri Oct 21 14:50:13 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.8 2005-10-21 14:50:13 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 765  remove_files() Line 802  remove_files()
802   # 1=keep me   #   # 1=keep me   #
803   case ${retval} in   case ${retval} in
804   0)   0)
805   [[ ${VERBOSE} = on ]] && echo -e "\t<<< FILE: ${MROOT}${pathto}"   # check if the file is config_protected
806   rm "${MROOT}${pathto}"   # ${MROOT} will automatically added if set !!
807     is_config_protected "${pathto}"
808     retval="$?"
809    
810     # 0 - not protected        #
811     # 1 - error                #
812     # 2 - protected            #
813     # 3 - protected but masked #
814    
815     case ${retval} in
816     # file is not protected - delete it
817     0|3)
818     [[ ${VERBOSE} = on ]] && echo -e "\t<<< FILE: ${MROOT}${pathto}"
819     rm "${MROOT}${pathto}"
820     ;;
821    
822     # file is protected, do not delete
823     2)
824     if [[ ${VERBOSE} = on ]]
825     then
826     echo -en "${COLRED}"
827     echo -n "! prot "
828     echo -en "${COLDEFAULT}"
829     echo " === FILE: ${MROOT}${pathto}"
830     fi
831     ;;
832     esac
833   ;;   ;;
   
834   1)   1)
835   [[ ${VERBOSE} = on ]] && \   [[ ${VERBOSE} = on ]] && \
836   echo -e "${COLRED}! mtime${COLDEFAULT} === FILE: ${MROOT}${pathto}"   echo -e "${COLRED}! mtime${COLDEFAULT} === FILE: ${MROOT}${pathto}"
# Line 1094  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 1226  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 1235  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.273  
changed lines
  Added in v.310