Magellan Linux

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

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

revision 226 by niro, Fri Sep 9 16:35:46 2005 UTC revision 294 by niro, Sun Dec 4 11:54:15 2005 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.1 2005-09-09 16:35:38 niro Exp $  # $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/mage4.functions.sh,v 1.11 2005-12-04 11:54:15 niro Exp $
4    
5  mage_setup()  mage_setup()
6  {  {
# Line 432  install_database_entry() Line 432  install_database_entry()
432   local magefile   local magefile
433   local dbrecorddir   local dbrecorddir
434   local provide   local provide
435     local i
436    
437   # very basic getops   # very basic getops
438   for i in $*   for i in $*
# Line 473  install_database_entry() Line 474  install_database_entry()
474    
475   # create fake file descriptors   # create fake file descriptors
476   # used by virtual and source packages   # used by virtual and source packages
  local i  
477   for i in .dirs .symlinks .files .pipes .char   for i in .dirs .symlinks .files .pipes .char
478   do   do
479   touch ${dbrecorddir}/${i}   touch ${dbrecorddir}/${i}
# Line 504  install_database_entry() Line 504  install_database_entry()
504   provide="$(get_value_from_magefile PROVIDE ${magefile})"   provide="$(get_value_from_magefile PROVIDE ${magefile})"
505   if [ -n "${provide}" ]   if [ -n "${provide}" ]
506   then   then
507   virtuals_add "${provide}" "${pcat}/${pname}"   for i in ${provide}
508     do
509     virtuals_add "${i}" "${pcat}/${pname}"
510     done
511   fi   fi
512  }  }
513    
# Line 523  remove_database_entry() Line 526  remove_database_entry()
526   local magefile   local magefile
527   local dbrecorddir   local dbrecorddir
528   local provide   local provide
529     local i
530    
531   # very basic getops   # very basic getops
532   for i in $*   for i in $*
# Line 552  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   virtuals_del "${provide}" "${pcat}/${pname}"   # first unregister virtuals
563     provide="$(get_value_from_magefile PROVIDE ${magefile})"
564     if [ -n "${provide}" ]
565     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 566  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 744  remove_files() Line 788  remove_files()
788   do   do
789   [ -z "${pathto}" ] && continue   [ -z "${pathto}" ] && continue
790    
791   if [ -e "${MROOT}${pathto}" ]   if [ ! -e "${MROOT}${pathto}" ]
792   then   then
793   [[ ${VERBOSE} = on ]] && \   [[ ${VERBOSE} = on ]] && \
794   echo -e "${COLRED}! exist${COLDEFAULT} === FILE: ${MROOT}${pathto}"   echo -e "${COLRED}! exist${COLDEFAULT} === FILE: ${MROOT}${pathto}"
# Line 758  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 932  remove_directories() Line 1001  remove_directories()
1001    
1002   [ ! -f ${MROOT}${INSTALLDB}/${pfull}/.char ] && die "remove_directories() .dirs not found"   [ ! -f ${MROOT}${INSTALLDB}/${pfull}/.char ] && die "remove_directories() .dirs not found"
1003    
  # uninstall of dirs ## added small hack to fix dirs  
  # must be reverse -> smage2 doesn't sort them  
  # -> using tac  
   
1004   # sets fieldseperator to "§" instead of " "   # sets fieldseperator to "§" instead of " "
1005   IFS=§   IFS=§
1006    
1007   while read pathto posix   # reversed order is mandatory !
1008     tac ${MROOT}${INSTALLDB}/${pfull}/.dirs | while read pathto posix
1009   do   do
1010   [ -z "${pathto}" ] && continue   [ -z "${pathto}" ] && continue
1011    
# Line 954  remove_directories() Line 1020  remove_directories()
1020   if [ -f "${MROOT}${pathto}/.keep" ]   if [ -f "${MROOT}${pathto}/.keep" ]
1021   then   then
1022   [[ ${VERBOSE} = on ]] && \   [[ ${VERBOSE} = on ]] && \
1023   echo -e "${COLRED}  .keep${COLDEFAULT} === DIR:  ${MROOT}${pathto}"   echo -e "${COLRED}! .keep${COLDEFAULT} === DIR:  ${MROOT}${pathto}"
1024   continue   continue
1025   fi   fi
1026    
# Line 971  remove_directories() Line 1037  remove_directories()
1037   [[ ${VERBOSE} = on ]] && \   [[ ${VERBOSE} = on ]] && \
1038   echo -e "${COLRED}! empty${COLDEFAULT} === DIR:  ${MROOT}${pathto}"   echo -e "${COLRED}! empty${COLDEFAULT} === DIR:  ${MROOT}${pathto}"
1039   fi   fi
1040   done < ${MROOT}${INSTALLDB}/${pfull}/.dirs   done
1041    
1042   # very important: unsetting the '§' fieldseperator   # very important: unsetting the '§' fieldseperator
1043   IFS=$'\n'   IFS=$'\n'
# Line 1090  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 1222  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 1231  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 ;;
# Line 1493  virtuals_add() Line 1559  virtuals_add()
1559   local oldline   local oldline
1560   local line i   local line i
1561   local installed_file   local installed_file
1562     local OLDIFS
1563    
1564   if virtuals_read ${virtualname}   if virtuals_read ${virtualname}
1565   then   then
# Line 1515  virtuals_add() Line 1582  virtuals_add()
1582   # make a backup   # make a backup
1583   mv ${MROOT}${VIRTUALDB_FILE} ${MROOT}${VIRTUALDB_FILE}.old   mv ${MROOT}${VIRTUALDB_FILE} ${MROOT}${VIRTUALDB_FILE}.old
1584    
1585     OLDIFS="${IFS}"
1586   IFS=$'\n'   IFS=$'\n'
1587   for line in $(< ${MROOT}${VIRTUALDB_FILE}.old)   for line in $(< ${MROOT}${VIRTUALDB_FILE}.old)
1588   do   do
# Line 1526  virtuals_add() Line 1594  virtuals_add()
1594   echo "${line}" >> ${MROOT}${VIRTUALDB_FILE}   echo "${line}" >> ${MROOT}${VIRTUALDB_FILE}
1595   fi   fi
1596   done   done
1597     # unset IFS
1598   #unset IFS   IFS="${OLDIFS}"
1599   else   else
1600   echo -ne "${COLBLUE} *** ${COLDEFAULT}"   echo -ne "${COLBLUE} >>> ${COLDEFAULT}"
1601   echo "register ${pkgname} as ${virtualname} ..."   echo "register ${pkgname} as ${virtualname} ..."
1602   echo "${virtualname} ${pkgname}" >> ${MROOT}${VIRTUALDB_FILE}   echo "${virtualname} ${pkgname}" >> ${MROOT}${VIRTUALDB_FILE}
1603   fi   fi
# Line 1541  virtuals_add() Line 1609  virtuals_add()
1609  #$1 virtualname; $2 pkgname  #$1 virtualname; $2 pkgname
1610  virtuals_del() {  virtuals_del() {
1611    
1612   local VIRTUAL_NAME PKG_NAME OLD_LINE METHOD line i x PKG_INSTALLED   local virtualname="$1"
1613     local pkgname="$2"
1614   VIRTUAL_NAME=$1   local oldline
1615   PKG_NAME=$2   local method
1616     local line i x
1617   #first check if exists   local pkg_installed
1618   if virtuals_read ${VIRTUAL_NAME}   local OLDIFS
1619    
1620     # first check if exists
1621     if virtuals_read ${virtualname}
1622   then   then
1623   #get method -> delall or update and check if ${PKG_NAME} exists in ${VIRTUAL_NAME}   # get method -> delall or update and check if ${PKG_NAME} exists in ${VIRTUAL_NAME}
1624   declare -i x=0   declare -i x=0
1625   for i in $(virtuals_read ${VIRTUAL_NAME} showpkgs)   for i in $(virtuals_read ${virtualname} showpkgs)
1626   do   do
1627   if [ "${i}" == "${PKG_NAME}" ]   if [[ ${i} = ${pkgname} ]]
1628   then   then
1629   PKG_INSTALLED=true   pkg_installed=true
1630   fi   fi
1631   ((x++))   ((x++))
1632   done   done
1633    
1634   #abort if not installed   # abort if not installed
1635   if [ "${PKG_INSTALLED}" != "true" ]   if [[ ${pkg_installed} != true ]]
1636   then   then
1637   echo "!!!! ${PKG_NAME} does not exists in ${VIRTUAL_NAME}."   echo -ne "${COLBLUE} --- ${COLDEFAULT}"
1638     echo "${pkgname} does not exists in ${virtualname}."
1639   return 0   return 0
1640   fi   fi
1641    
1642   if [ ${x} -ge 2 ]   if [ ${x} -ge 2 ]
1643   then   then
1644   METHOD=update   method=update
1645   else   else
1646   METHOD=delall   method=delall
1647   fi   fi
1648    
1649   #get the complete line   # get the complete line
1650   OLD_LINE="$(virtuals_read ${VIRTUAL_NAME} showline)"   oldline="$(virtuals_read ${virtualname} showline)"
1651    
1652   #make a backup   # make a backup of the db
1653   mv ${VIRTUALDB_FILE} ${VIRTUALDB_FILE}.old   mv ${VIRTUALDB_FILE} ${VIRTUALDB_FILE}.old
1654    
1655   #parse virtualdb   # parse virtualdb
1656     OLDIFS="${IFS}"
1657   IFS=$'\n'   IFS=$'\n'
1658   for line in $(< ${VIRTUALDB_FILE}.old)   for line in $(< ${VIRTUALDB_FILE}.old)
1659   do   do
1660   if [ "${line}" == "${OLD_LINE}" ]   if [[ ${line} = ${oldline} ]]
1661   then   then
1662   #delall or update?   #delall or update?
1663   case ${METHOD} in   case ${method} in
1664   update)   update)
1665   echo "<<<< Unlinking ${PKG_NAME} from ${VIRTUAL_NAME} in virtual database ..."   echo -ne "${COLBLUE} *** ${COLDEFAULT}"
1666   #del PKG_NAME from line   echo "Unlinking ${pkgname} from ${virtualname} in virtual database ..."
1667   echo "${line/ ${PKG_NAME}/}" >> ${VIRTUALDB_FILE}   # del PKG_NAME from line
1668     echo "${line/ ${pkgname}/}" >> ${VIRTUALDB_FILE}
1669   ;;   ;;
1670   delall)   delall)
1671   echo "<<<< Deleting ${VIRTUAL_NAME} in virtual database ..."   echo -ne "${COLBLUE} <<< ${COLDEFAULT}"
1672   #continue; do not write anything   echo "Deleting ${virtualname} in virtual database ..."
1673     # continue; do not write anything
1674   continue   continue
1675   ;;   ;;
1676   esac   esac
# Line 1603  virtuals_del() { Line 1678  virtuals_del() {
1678   echo "${line}" >> ${VIRTUALDB_FILE}   echo "${line}" >> ${VIRTUALDB_FILE}
1679   fi   fi
1680   done   done
1681   unset IFS   # unset IFS
1682     IFS="${OLDIFS}"
1683   else   else
1684   echo "!!!! ${VIRTUAL_NAME} does not exists in virtual database."   echo -ne "${COLBLUE} --- ${COLDEFAULT}"
1685     echo "${virtualname} does not exists in virtual database."
1686   fi   fi
1687  }  }
1688    
# Line 1670  is_newer_mage_version_available() Line 1747  is_newer_mage_version_available()
1747   local newest_mage   local newest_mage
1748   local installed_mage   local installed_mage
1749    
1750   newest_mage="$( CATEGORIE=app-mage MAGENAME=mage get_highest_magefile;echo $(basename ${MAGEFILE} .mage) )"   newest_mage="$(basename $(get_highest_magefile app-mage mage) .mage)"
1751   installed_mage="$(magequery -n mage | cut -d' ' -f5)"   installed_mage="$(magequery -n mage | cut -d' ' -f5)"
1752    
1753   if [[ ${newest_mage} > ${installed_mage} ]]   if [[ ${newest_mage} > ${installed_mage} ]]
# Line 1963  get_value_from_magefile() Line 2040  get_value_from_magefile()
2040   local PKGTYPE   local PKGTYPE
2041   local preinstall   local preinstall
2042   local postinstall   local postinstall
2043     local preremove
2044     local postremove
2045    
2046   # sanity checks   # sanity checks
2047   [ -f ${magefile} ] && source ${magefile} || \   [ -f ${magefile} ] && source ${magefile} || \
# Line 1972  get_value_from_magefile() Line 2051  get_value_from_magefile()
2051   source ${magefile}   source ${magefile}
2052   eval value=\$$(echo ${var})   eval value=\$$(echo ${var})
2053   echo "${value}"   echo "${value}"
2054    
2055     # unset these functions
2056     unset -f preinstall
2057     unset -f postinstall
2058     unset -f preremove
2059     unset -f postremove
2060  }  }
2061    
2062  mage_install()  mage_install()
# Line 1988  mage_install() Line 2073  mage_install()
2073   local PKGTYPE   local PKGTYPE
2074   local preinstall   local preinstall
2075   local postinstall   local postinstall
2076     local preremove
2077     local postremove
2078    
2079   local pcat   local pcat
2080   local pname   local pname
# Line 2149  mage_install() Line 2236  mage_install()
2236  # echo -ne "${COLBLUE}${pcat}/${COLDEFAULT}"  # echo -ne "${COLBLUE}${pcat}/${COLDEFAULT}"
2237  # echo -ne "${COLGREEN}${pname}-${pver}-${pbuild}${COLDEFAULT} "  # echo -ne "${COLGREEN}${pname}-${pver}-${pbuild}${COLDEFAULT} "
2238   echo "successfully installed."   echo "successfully installed."
2239    
2240     # unset these functions
2241     unset -f preinstall
2242     unset -f postinstall
2243     unset -f preremove
2244     unset -f postremove
2245  }  }
2246    
2247  md5sum_packages()  md5sum_packages()
# Line 2253  uninstall_packages() Line 2346  uninstall_packages()
2346   echo -ne "${COLBLUE} --- ${COLDEFAULT}"   echo -ne "${COLBLUE} --- ${COLDEFAULT}"
2347   echo "following candidate(s) will be removed:"   echo "following candidate(s) will be removed:"
2348   echo -ne "${COLBLUE} --- ${COLDEFAULT}"   echo -ne "${COLBLUE} --- ${COLDEFAULT}"
2349   echo -ne "\033[1m${can_pcat}/${can_pname}:${COLDEFAULT}"   echo -ne "${COLBOLD}${can_pcat}/${can_pname}:${COLDEFAULT}"
2350   echo -e "${COLRED} ${can_ver_list} ${COLDEFAULT}"   echo -e "${COLRED} ${can_ver_list} ${COLDEFAULT}"
2351   echo   echo
2352   echo -ne "${COLBLUE} --- ${COLDEFAULT}"   if [ ${MAGE_UNINSTALL_TIMEOUT} -gt 0 ]
2353   echo "( Press [CTRL+C] to abort )"   then
2354   echo -ne "${COLBLUE} --- ${COLDEFAULT}"   echo -ne "${COLBLUE} --- ${COLDEFAULT}"
2355   echo -n "Waiting ${MAGE_UNINSTALL_TIMEOUT} seconds ..."   echo "( Press [CTRL+C] to abort )"
2356   for ((i=MAGE_UNINSTALL_TIMEOUT; i >= 0; i--))   echo -ne "${COLBLUE} --- ${COLDEFAULT}"
2357   do   echo -n "Waiting ${MAGE_UNINSTALL_TIMEOUT} seconds ..."
2358   echo -ne "${COLRED} ${i}${COLDEFAULT}"   for ((i=MAGE_UNINSTALL_TIMEOUT; i >= 0; i--))
2359   sleep 1   do
2360   done   echo -ne "${COLRED} ${i}${COLDEFAULT}"
2361   echo   sleep 1
2362   echo   done
2363     echo
2364     echo
2365     fi
2366    
2367   for pkg in ${list}   for pkg in ${list}
2368   do   do
# Line 2304  mage_uninstall() Line 2400  mage_uninstall()
2400   local PKGTYPE   local PKGTYPE
2401   local preinstall   local preinstall
2402   local postinstall   local postinstall
2403     local preremove
2404     local postremove
2405    
2406   local pcat   local pcat
2407   local pname   local pname
# Line 2341  mage_uninstall() Line 2439  mage_uninstall()
2439   echo -ne "${COLBLUE}${pcat}/${COLDEFAULT}"   echo -ne "${COLBLUE}${pcat}/${COLDEFAULT}"
2440   echo -e "${COLGREEN}${pname}-${pver}-${pbuild}${COLDEFAULT}"   echo -e "${COLGREEN}${pname}-${pver}-${pbuild}${COLDEFAULT}"
2441    
2442   magefile="${MAGEDIR}/${pcat}/${pname}/${pname}-${pver}-${pbuild}.mage"   magefile="${INSTALLDB}/${pcat}/${pname}-${pver}-${pbuild}/${pname}-${pver}-${pbuild}.mage"
2443   source ${magefile}   source ${magefile}
2444    
2445   ## preremove scripts   ## preremove scripts
# Line 2401  mage_uninstall() Line 2499  mage_uninstall()
2499  # echo -ne "${COLBLUE}${pcat}/${COLDEFAULT}"  # echo -ne "${COLBLUE}${pcat}/${COLDEFAULT}"
2500  # echo -ne "${COLGREEN}${pname}-${pver}-${pbuild}${COLDEFAULT} "  # echo -ne "${COLGREEN}${pname}-${pver}-${pbuild}${COLDEFAULT} "
2501   echo "successfully removed."   echo "successfully removed."
2502    
2503     # unset these functions
2504     unset -f preinstall
2505     unset -f postinstall
2506     unset -f preremove
2507     unset -f postremove
2508  }  }
2509    
2510  show_etc_update_mesg() {  show_etc_update_mesg() {
# Line 2415  show_etc_update_mesg() { Line 2519  show_etc_update_mesg() {
2519   echo "Please run 'etc-update' to update your configuration files."   echo "Please run 'etc-update' to update your configuration files."
2520   echo   echo
2521  }  }
2522    
2523    pkgsearch()
2524    {
2525     local string="$1"
2526     local result
2527     local pkg
2528     local pcat
2529     local pname
2530     local magefile
2531     local pver
2532     local pbuild
2533     local state
2534     local descriptiom
2535     local homepage
2536     local i
2537     local all_installed
2538     local ipver
2539     local ipbuild
2540    
2541     # only names no versions
2542     result="$(find ${MAGEDIR} -mindepth 2 -maxdepth 2 -type d -name *${string}*)"
2543     #result="$(find ${MAGEDIR} -type f -name *${string}*.mage | sort)"
2544    
2545     # nothing found
2546     [[ -z ${result} ]] && die "No package found containing '${string}' in the name."
2547    
2548     for pkg in ${result}
2549     do
2550     # dirty, but does the job
2551     pcat="$(magename2pcat ${pkg}/foo)"
2552     pname="$(magename2pname ${pkg}-foo-foo)"
2553    
2554     # get highest version available
2555     magefile=$(get_highest_magefile ${pcat} ${pname})
2556    
2557     # now get all needed infos to print a nice output
2558     pver="$(magename2pver ${magefile})"
2559     pbuild="$(magename2pbuild ${magefile})"
2560     state="$(get_value_from_magefile STATE ${magefile})"
2561     description="$(get_value_from_magefile DESCRIPTION ${magefile})"
2562     homepage="$(get_value_from_magefile HOMEPAGE ${magefile})"
2563    
2564     # all installed
2565     for i in $(get_uninstall_candidates --pname ${pname} --pcat ${pcat})
2566     do
2567     ipver="$(magename2pver ${i})"
2568     ipbuild="$(magename2pbuild ${i})"
2569    
2570     if [[ -z ${all_installed} ]]
2571     then
2572     all_installed="${ipver}-${ipbuild}"
2573     else
2574     all_installed="${all_installed} ${ipver}-${ipbuild}"
2575     fi
2576     done
2577     [[ -z ${all_installed} ]] && all_installed="none"
2578    
2579     case ${state} in
2580     stable) state=${COLGREEN}"[s] ";;
2581     testing) state=${COLYELLOW}"[t] ";;
2582     unstable) state=${COLRED}"[u] ";;
2583     old) state=${COLGRAY}"[o] ";;
2584     esac
2585    
2586     echo -e "${state}${pcat}/${pname}"${COLDEFAULT}
2587     echo "      Latest available:   ${pver}-${pbuild}"
2588     echo "      Installed versions: ${all_installed}"
2589     echo "      Description: ${description}"
2590     echo "      Homepage: ${homepage}"
2591     echo
2592    
2593     unset pcat
2594     unset pname
2595     unset magefile
2596     unset pver
2597     unset pbuild
2598     unset state
2599     unset descriptiom
2600     unset homepage
2601     unset all_installed
2602     unset ipver
2603     unset ipbuild
2604     done
2605    }
2606    
2607    export_inherits()
2608    {
2609     local include="$1"
2610     shift
2611    
2612     while [ "$1" ]
2613     do
2614     local functions="$1"
2615    
2616     # sanity checks
2617     [ -z "${include}" ] && die "export_inherits(): \$include not given."
2618     [ -z "${functions}" ] && die "export_inherits(): \$functions not given."
2619    
2620     eval "${functions}() { ${include}_${functions} ; }"
2621    
2622     # debug
2623     [[ ${MAGEDEBUG} = on ]] && typeset -f "${functions}"
2624    
2625     shift
2626     done
2627    }

Legend:
Removed from v.226  
changed lines
  Added in v.294