Magellan Linux

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

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

trunk/mage/usr/lib/mage/mage4.functions.sh revision 2271 by niro, Fri Oct 25 07:28:23 2013 UTC branches/mage-next/src/mage4.functions.sh revision 2560 by niro, Wed Jan 29 12:12:22 2014 UTC
# Line 1472  fetch_packages() Line 1472  fetch_packages()
1472   local list="$@"   local list="$@"
1473   local pkgname   local pkgname
1474   local pkgfile   local pkgfile
1475     local pcat
1476     local pname
1477   local mirr   local mirr
1478   local magefile   local magefile
1479   local md5file   local md5file
# Line 1479  fetch_packages() Line 1481  fetch_packages()
1481   local count_current   local count_current
1482   local count_total   local count_total
1483   local wget_opts   local wget_opts
1484     local fetching
1485    
1486   [ -z "${MIRRORS}" ] && die "You have no mirrors defined. Please edit your ${MAGERC}."   [ -z "${MIRRORS}" ] && die "You have no mirrors defined. Please edit your ${MAGERC}."
1487    
# Line 1497  fetch_packages() Line 1500  fetch_packages()
1500   pkgfile="${pkgname}.${PKGSUFFIX}"   pkgfile="${pkgname}.${PKGSUFFIX}"
1501   pkgtype="$(get_value_from_magefile PKGTYPE ${magefile})"   pkgtype="$(get_value_from_magefile PKGTYPE ${magefile})"
1502    
1503     pcat=$(magename2pcat ${magefile})
1504     pname=$(magename2pname ${magefile})
1505     md5file="${MAGEDIR}/${pcat}/${pname}/md5/${pkgname}.md5"
1506    
1507   (( count_current++ ))   (( count_current++ ))
1508   xtitle "[ (${count_current}/${count_total}) Fetching ${pkgfile} ]"   xtitle "[ (${count_current}/${count_total}) Fetching ${pkgfile} ]"
1509    
# Line 1516  fetch_packages() Line 1523  fetch_packages()
1523   continue   continue
1524   fi   fi
1525    
1526   # abort if already exist   # check if FETCHING is required
1527   if [ -f ${PKGDIR}/${pkgfile} ]   if [ ! -f "${md5file}" ]
1528     then
1529     fetching=true
1530     else
1531     if mchecksum --rundir "${PKGDIR}" --file "${md5file}" --method md5 &> /dev/null
1532     then
1533     # md5's ok, no fetching required
1534     fetching=false
1535     else
1536     fetching=true
1537     fi
1538     fi
1539    
1540     if [[ ${fetching} = false ]]
1541   then   then
1542   echo -ne " ${COLBLUE}***${COLDEFAULT}"   echo -ne " ${COLBLUE}***${COLDEFAULT}"
1543   echo " fetch complete (${count_current}/${count_total}): ${pkgfile} ... "   echo " fetch complete (${count_current}/${count_total}): ${pkgfile} ... "
1544   continue   continue
1545     else
1546     echo -ne " ${COLBLUE}***${COLDEFAULT}"
1547     echo -e " fetching (${count_current}/${count_total}): ${pkgfile} ... "
1548     mdownload --uri "package://${pkgfile}" --dir "${PKGDIR}" || die "Could not download ${pkgfile}"
1549   fi   fi
1550    
1551   echo -ne " ${COLBLUE}***${COLDEFAULT}"   # sanity check, not really needed but to be sure
  echo -e " fetching (${count_current}/${count_total}): ${pkgfile} ... "  
  mdownload --uri "package://${pkgfile}" --dir "${PKGDIR}" || die "Could not download ${pkgfile}"  
1552   if [ ! -f ${PKGDIR}/${pkgfile} ]   if [ ! -f ${PKGDIR}/${pkgfile} ]
1553   then   then
1554   die "Package '${pkgfile}' after download not found in '${PKGDIR}'"   die "Package '${pkgfile}' after download not found in '${PKGDIR}'"
# Line 2234  sminclude() Line 2256  sminclude()
2256   then   then
2257   for i in $*   for i in $*
2258   do   do
2259   echo "--- Including ${SMAGESCRIPTSDIR}/include/${i}.sminc"   [[ ${SILENT} = 1 ]] || echo "--- Including ${SMAGESCRIPTSDIR}/include/${i}.sminc"
2260   source ${SMAGESCRIPTSDIR}/include/${i}.sminc   source ${SMAGESCRIPTSDIR}/include/${i}.sminc
2261   done   done
2262   echo   [[ ${SILENT} = 1 ]] || echo
2263   fi   fi
2264  }  }
2265    
# Line 2541  get_value_from_magefile() Line 2563  get_value_from_magefile()
2563   local SDEPEND   local SDEPEND
2564   local PROVIDE   local PROVIDE
2565   local PKGTYPE   local PKGTYPE
  local MAGE_TARGETS  
2566   local SPLIT_PACKAGE_BASE   local SPLIT_PACKAGE_BASE
2567   local preinstall   local preinstall
2568   local postinstall   local postinstall
# Line 2663  mage_install() Line 2684  mage_install()
2684   echo B:${pbuild}   echo B:${pbuild}
2685   fi   fi
2686    
2687   if [[ -n ${MAGE_TARGETS} ]]   if [[ -n ${SPLIT_PACKAGE_BASE} ]]
  then  
  # basic svn compat  
  if [[ -d ${SMAGESCRIPTSDIR}/.svn ]]  
  then  
  for i in ${SMAGESCRIPTSDIR}/*/${pname/${MAGE_TARGETS}/}/${pname/${MAGE_TARGETS}/}-${pver}-${pbuild}.smage2  
  do  
  smage2file="${i}"  
  done  
  else  
  smage2file=${SMAGESCRIPTSDIR}/${pname/${MAGE_TARGETS}/}/${pname/${MAGE_TARGETS}/}-${pver}-${pbuild}.smage2  
  fi  
   
  elif [[ -n ${SPLIT_PACKAGE_BASE} ]]  
2688   then   then
2689   # basic svn compat   # basic svn compat
2690   if [[ -d ${SMAGESCRIPTSDIR}/.svn ]]   if [[ -d ${SMAGESCRIPTSDIR}/.svn ]]
# Line 3046  mage_uninstall() Line 3054  mage_uninstall()
3054   unset -f postremove   unset -f postremove
3055  }  }
3056    
3057    # rerun_pkgfunctions [method] pkg1 pkg2 pkg3
3058    rerun_pkgfunctions()
3059    {
3060     local method
3061     local list
3062     local pcat
3063     local pname
3064     local pver
3065     local pbuild
3066     local magefile
3067     local i
3068    
3069     # very basic getops
3070     case $1 in
3071     --method) shift; method="$1" ;;
3072     esac
3073     shift
3074     local list="$@"
3075    
3076     # sanity check
3077     case ${method} in
3078     preinstall|postinstall) ;;
3079     preremove|postremove) ;;
3080     *) die "rerun_pkgfunctions(): Unknown method '${method}'." ;;
3081     esac
3082    
3083     if [[ -n ${MROOT} ]]
3084     then
3085     echo -ne ${COLRED}
3086     echo "!! running in MROOT=${MROOT}"
3087     echo -ne ${COLDEFAULT}
3088     echo
3089     fi
3090    
3091     for pkg in ${list}
3092     do
3093     pcat=$(dep2pcat ${pkg})
3094     pname=$(magename2pname ${pkg})
3095     pver=$(magename2pver ${pkg})
3096     pbuild=$(magename2pbuild ${pkg})
3097     magefile="${MROOT}${INSTALLDB}/${pcat}/${pname}-${pver}-${pbuild}/${pname}-${pver}-${pbuild}.mage"
3098    
3099     if [ -e ${magefile} ]
3100     then
3101     source ${magefile}
3102     if [ -n "$(typeset -f ${method})" ]
3103     then
3104     echo -e " ${COLBLUE}***${COLDEFAULT} running ${method} for ${pkg} ... "
3105     ${method}
3106     else
3107     echo "No ${method}() for pkg '${pkg}' defined. Doing nothing."
3108     fi
3109     unset -f preinstall postinstall preremove postremove
3110     else
3111     die "Magefile '${magefile}' does not exist."
3112     fi
3113     done
3114    }
3115    
3116  show_etc_update_mesg()  show_etc_update_mesg()
3117  {  {
3118   [ ${MAGE_PROTECT_COUNTER} -eq 0 ] && return 0   [ ${MAGE_PROTECT_COUNTER} -eq 0 ] && return 0

Legend:
Removed from v.2271  
changed lines
  Added in v.2560