Magellan Linux

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

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

revision 237 by niro, Sat Sep 10 13:35:55 2005 UTC revision 258 by niro, Tue Oct 4 14:35:21 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.2 2005-09-10 13:35:55 niro Exp $  # $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/mage4.functions.sh,v 1.7 2005-10-04 14:35:21 niro Exp $
4    
5  mage_setup()  mage_setup()
6  {  {
# Line 744  remove_files() Line 744  remove_files()
744   do   do
745   [ -z "${pathto}" ] && continue   [ -z "${pathto}" ] && continue
746    
747   if [ -e "${MROOT}${pathto}" ]   if [ ! -e "${MROOT}${pathto}" ]
748   then   then
749   [[ ${VERBOSE} = on ]] && \   [[ ${VERBOSE} = on ]] && \
750   echo -e "${COLRED}! exist${COLDEFAULT} === FILE: ${MROOT}${pathto}"   echo -e "${COLRED}! exist${COLDEFAULT} === FILE: ${MROOT}${pathto}"
# Line 932  remove_directories() Line 932  remove_directories()
932    
933   [ ! -f ${MROOT}${INSTALLDB}/${pfull}/.char ] && die "remove_directories() .dirs not found"   [ ! -f ${MROOT}${INSTALLDB}/${pfull}/.char ] && die "remove_directories() .dirs not found"
934    
  # uninstall of dirs ## added small hack to fix dirs  
  # must be reverse -> smage2 doesn't sort them  
  # -> using tac  
   
935   # sets fieldseperator to "§" instead of " "   # sets fieldseperator to "§" instead of " "
936   IFS=§   IFS=§
937    
938   while read pathto posix   # reversed order is mandatory !
939     tac ${MROOT}${INSTALLDB}/${pfull}/.dirs | while read pathto posix
940   do   do
941   [ -z "${pathto}" ] && continue   [ -z "${pathto}" ] && continue
942    
# Line 954  remove_directories() Line 951  remove_directories()
951   if [ -f "${MROOT}${pathto}/.keep" ]   if [ -f "${MROOT}${pathto}/.keep" ]
952   then   then
953   [[ ${VERBOSE} = on ]] && \   [[ ${VERBOSE} = on ]] && \
954   echo -e "${COLRED}  .keep${COLDEFAULT} === DIR:  ${MROOT}${pathto}"   echo -e "${COLRED}! .keep${COLDEFAULT} === DIR:  ${MROOT}${pathto}"
955   continue   continue
956   fi   fi
957    
# Line 971  remove_directories() Line 968  remove_directories()
968   [[ ${VERBOSE} = on ]] && \   [[ ${VERBOSE} = on ]] && \
969   echo -e "${COLRED}! empty${COLDEFAULT} === DIR:  ${MROOT}${pathto}"   echo -e "${COLRED}! empty${COLDEFAULT} === DIR:  ${MROOT}${pathto}"
970   fi   fi
971   done < ${MROOT}${INSTALLDB}/${pfull}/.dirs   done
972    
973   # very important: unsetting the '§' fieldseperator   # very important: unsetting the '§' fieldseperator
974   IFS=$'\n'   IFS=$'\n'
# Line 1670  is_newer_mage_version_available() Line 1667  is_newer_mage_version_available()
1667   local newest_mage   local newest_mage
1668   local installed_mage   local installed_mage
1669    
1670   newest_mage="$( CATEGORIE=app-mage MAGENAME=mage get_highest_magefile;echo $(basename ${MAGEFILE} .mage) )"   newest_mage="$(basename $(get_highest_magefile app-mage mage) .mage)"
1671   installed_mage="$(magequery -n mage | cut -d' ' -f5)"   installed_mage="$(magequery -n mage | cut -d' ' -f5)"
1672    
1673   if [[ ${newest_mage} > ${installed_mage} ]]   if [[ ${newest_mage} > ${installed_mage} ]]
# Line 1963  get_value_from_magefile() Line 1960  get_value_from_magefile()
1960   local PKGTYPE   local PKGTYPE
1961   local preinstall   local preinstall
1962   local postinstall   local postinstall
1963     local preremove
1964     local postremove
1965    
1966   # sanity checks   # sanity checks
1967   [ -f ${magefile} ] && source ${magefile} || \   [ -f ${magefile} ] && source ${magefile} || \
# Line 1972  get_value_from_magefile() Line 1971  get_value_from_magefile()
1971   source ${magefile}   source ${magefile}
1972   eval value=\$$(echo ${var})   eval value=\$$(echo ${var})
1973   echo "${value}"   echo "${value}"
1974    
1975     # unset these functions
1976     unset -f preinstall
1977     unset -f postinstall
1978     unset -f preremove
1979     unset -f postremove
1980  }  }
1981    
1982  mage_install()  mage_install()
# Line 1988  mage_install() Line 1993  mage_install()
1993   local PKGTYPE   local PKGTYPE
1994   local preinstall   local preinstall
1995   local postinstall   local postinstall
1996     local preremove
1997     local postremove
1998    
1999   local pcat   local pcat
2000   local pname   local pname
# Line 2149  mage_install() Line 2156  mage_install()
2156  # echo -ne "${COLBLUE}${pcat}/${COLDEFAULT}"  # echo -ne "${COLBLUE}${pcat}/${COLDEFAULT}"
2157  # echo -ne "${COLGREEN}${pname}-${pver}-${pbuild}${COLDEFAULT} "  # echo -ne "${COLGREEN}${pname}-${pver}-${pbuild}${COLDEFAULT} "
2158   echo "successfully installed."   echo "successfully installed."
2159    
2160     # unset these functions
2161     unset -f preinstall
2162     unset -f postinstall
2163     unset -f preremove
2164     unset -f postremove
2165  }  }
2166    
2167  md5sum_packages()  md5sum_packages()
# Line 2253  uninstall_packages() Line 2266  uninstall_packages()
2266   echo -ne "${COLBLUE} --- ${COLDEFAULT}"   echo -ne "${COLBLUE} --- ${COLDEFAULT}"
2267   echo "following candidate(s) will be removed:"   echo "following candidate(s) will be removed:"
2268   echo -ne "${COLBLUE} --- ${COLDEFAULT}"   echo -ne "${COLBLUE} --- ${COLDEFAULT}"
2269   echo -ne "\033[1m${can_pcat}/${can_pname}:${COLDEFAULT}"   echo -ne "${COLBOLD}${can_pcat}/${can_pname}:${COLDEFAULT}"
2270   echo -e "${COLRED} ${can_ver_list} ${COLDEFAULT}"   echo -e "${COLRED} ${can_ver_list} ${COLDEFAULT}"
2271   echo   echo
2272   echo -ne "${COLBLUE} --- ${COLDEFAULT}"   if [ ${MAGE_UNINSTALL_TIMEOUT} -gt 0 ]
2273   echo "( Press [CTRL+C] to abort )"   then
2274   echo -ne "${COLBLUE} --- ${COLDEFAULT}"   echo -ne "${COLBLUE} --- ${COLDEFAULT}"
2275   echo -n "Waiting ${MAGE_UNINSTALL_TIMEOUT} seconds ..."   echo "( Press [CTRL+C] to abort )"
2276   for ((i=MAGE_UNINSTALL_TIMEOUT; i >= 0; i--))   echo -ne "${COLBLUE} --- ${COLDEFAULT}"
2277   do   echo -n "Waiting ${MAGE_UNINSTALL_TIMEOUT} seconds ..."
2278   echo -ne "${COLRED} ${i}${COLDEFAULT}"   for ((i=MAGE_UNINSTALL_TIMEOUT; i >= 0; i--))
2279   sleep 1   do
2280   done   echo -ne "${COLRED} ${i}${COLDEFAULT}"
2281   echo   sleep 1
2282   echo   done
2283     echo
2284     echo
2285     fi
2286    
2287   for pkg in ${list}   for pkg in ${list}
2288   do   do
# Line 2304  mage_uninstall() Line 2320  mage_uninstall()
2320   local PKGTYPE   local PKGTYPE
2321   local preinstall   local preinstall
2322   local postinstall   local postinstall
2323     local preremove
2324     local postremove
2325    
2326   local pcat   local pcat
2327   local pname   local pname
# Line 2341  mage_uninstall() Line 2359  mage_uninstall()
2359   echo -ne "${COLBLUE}${pcat}/${COLDEFAULT}"   echo -ne "${COLBLUE}${pcat}/${COLDEFAULT}"
2360   echo -e "${COLGREEN}${pname}-${pver}-${pbuild}${COLDEFAULT}"   echo -e "${COLGREEN}${pname}-${pver}-${pbuild}${COLDEFAULT}"
2361    
2362   magefile="${MAGEDIR}/${pcat}/${pname}/${pname}-${pver}-${pbuild}.mage"   magefile="${INSTALLDB}/${pcat}/${pname}-${pver}-${pbuild}/${pname}-${pver}-${pbuild}.mage"
2363   source ${magefile}   source ${magefile}
2364    
2365   ## preremove scripts   ## preremove scripts
# Line 2401  mage_uninstall() Line 2419  mage_uninstall()
2419  # echo -ne "${COLBLUE}${pcat}/${COLDEFAULT}"  # echo -ne "${COLBLUE}${pcat}/${COLDEFAULT}"
2420  # echo -ne "${COLGREEN}${pname}-${pver}-${pbuild}${COLDEFAULT} "  # echo -ne "${COLGREEN}${pname}-${pver}-${pbuild}${COLDEFAULT} "
2421   echo "successfully removed."   echo "successfully removed."
2422    
2423     # unset these functions
2424     unset -f preinstall
2425     unset -f postinstall
2426     unset -f preremove
2427     unset -f postremove
2428  }  }
2429    
2430  show_etc_update_mesg() {  show_etc_update_mesg() {
# Line 2499  pkgsearch() Line 2523  pkgsearch()
2523   unset ipbuild   unset ipbuild
2524   done   done
2525  }  }
2526    
2527    export_inherits()
2528    {
2529     local include="$1"
2530     shift
2531    
2532     while [ "$1" ]
2533     do
2534     local functions="$1"
2535    
2536     # sanity checks
2537     [ -z "${include}" ] && die "export_inherits(): \$include not given."
2538     [ -z "${functions}" ] && die "export_inherits(): \$functions not given."
2539    
2540     eval "${functions}() { ${include}_${functions} ; }"
2541    
2542     # debug
2543     [[ ${MAGEDEBUG} = on ]] && typeset -f "${functions}"
2544    
2545     shift
2546     done
2547    }

Legend:
Removed from v.237  
changed lines
  Added in v.258