Magellan Linux

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

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

revision 1599 by niro, Fri Dec 30 10:07:18 2011 UTC revision 1654 by niro, Fri Jan 13 23:20:39 2012 UTC
# Line 66  mchecksum() Line 66  mchecksum()
66   case ${method} in   case ${method} in
67   md5) cmd="md5sum" ;;   md5) cmd="md5sum" ;;
68   sha256) cmd="sha256sum" ;;   sha256) cmd="sha256sum" ;;
69   *) die "mchecksum(): unkown method '${method}'" ;;   *) die "mchecksum(): unknown method '${method}'" ;;
70   esac   esac
71    
72   if [[ -d ${rundir} ]]   if [[ -d ${rundir} ]]
# Line 82  mchecksum() Line 82  mchecksum()
82   return "${retval}"   return "${retval}"
83  }  }
84    
85    mcheckemptydir()
86    {
87     local dir="$1"
88     local retval=1
89    
90     if [[ ! -d ${dir} ]]
91     then
92     echo "mcheckemptydir(): '${dir}' is not a directory!"
93     retval=3
94     else
95     shopt -s nullglob dotglob
96     files=( ${dir}/* )
97     (( ${#files[*]} )) || retval=0
98     shopt -u nullglob dotglob
99     fi
100    
101     return ${retval}
102    }
103    
104  unpack_packages()  unpack_packages()
105  {  {
106   local list="$@"   local list="$@"
# Line 1401  mdownload() Line 1420  mdownload()
1420   real_uris="$(convertmirrors ${uri})"   real_uris="$(convertmirrors ${uri})"
1421    
1422   # verbose or not   # verbose or not
1423   mqueryfeature "!verbose" && wget_opts="--quiet"   mqueryfeature "!verbose" && wget_opts+=" --quiet"
1424    
1425   # filter wget options if busybox was found   # filter wget options if busybox was found
1426   wget_opts="$(busybox_filter_wget_options ${WGET_FETCH_OPTIONS})"   wget_opts+=" $(busybox_filter_wget_options ${WGET_FETCH_OPTIONS})"
1427    
1428   # create outputdir   # create outputdir
1429   [[ ! -d ${outputdir} ]] && install -d "${outputdir}"   [[ ! -d ${outputdir} ]] && install -d "${outputdir}"
# Line 1579  syncmage_tarball() Line 1598  syncmage_tarball()
1598   else   else
1599   echo -ne "${COLBLUE} --- ${COLDEFAULT}"   echo -ne "${COLBLUE} --- ${COLDEFAULT}"
1600   echo -n "checking md5sum... "   echo -n "checking md5sum... "
1601   ( cd ${temp}; md5sum -c ${latest_md5} ) || die "md5 for ${latest_tarball} failed"   mchecksum --rundir "${temp}" --file "${latest_md5}" --method md5 || die "md5 for ${latest_tarball} failed"
1602   fi   fi
1603    
1604   if [[ -d ${MAGEDIR} ]]   if [[ -d ${MAGEDIR} ]]
1605   then   then
1606   echo -ne "${COLBLUE} --- ${COLDEFAULT}"   echo -ne "${COLBLUE} --- ${COLDEFAULT}"
1607   echo "cleaning old mage-tree ${MAGEDIR}..."   echo "cleaning old mage-tree ${MAGEDIR}..."
1608   rm -rf ${MAGEDIR}   # honor mountpoints and empty dirs
1609     if mountpoint -q ${MAGEDIR}
1610     then
1611     if ! mcheckemptydir ${MAGEDIR}
1612     then
1613     find ${MAGEDIR} -mindepth 1 -maxdepth 1 | xarg --no-run-if-empty rm -r
1614     fi
1615     else
1616     rm -rf ${MAGEDIR}
1617     fi
1618   fi   fi
1619    
1620   if need_busybox_support tar   if need_busybox_support tar
# Line 1645  xtitleclean() Line 1673  xtitleclean()
1673  }  }
1674    
1675    
1676  # cuts full pathnames or versionized names down to basename  # unused?
1677  choppkgname()  #
1678  {  # # cuts full pathnames or versionized names down to basename
1679   #we want this only if full name was used  # choppkgname()
1680   if [ -n "$(echo ${MAGENAME}|fgrep .mage)" ]  # {
1681   then  # #we want this only if full name was used
1682   #cuts ARCH and PBUILD  # if [ -n "$(echo ${MAGENAME}|fgrep .mage)" ]
1683   #ARCH comes from ${MAGERC}  # then
1684   MAGENAME=$(echo ${MAGENAME} |sed -e "s:-${ARCH}-r*.::g")  # #cuts ARCH and PBUILD
1685    # #ARCH comes from ${MAGERC}
1686    # MAGENAME=$(echo ${MAGENAME} |sed -e "s:-${ARCH}$(print_distrotag)-r*.::g")
1687    #
1688    # #cuts version number
1689    # MAGENAME=$(basename ${MAGENAME%-*} .mage)
1690    # fi
1691    # }
1692    
  #cuts version number  
  MAGENAME=$(basename ${MAGENAME%-*} .mage)  
  fi  
 }  
1693    
1694  # get_categorie $PNAME, returns CATEGORIE  # get_categorie $PNAME, returns CATEGORIE
1695  # $1=pname  # $1=pname
# Line 2759  md5sum_packages() Line 2790  md5sum_packages()
2790   then   then
2791   echo -ne "${COLBLUE} *** ${COLDEFAULT}"   echo -ne "${COLBLUE} *** ${COLDEFAULT}"
2792   echo -ne "checking md5sum (${count_current}/${count_total}): "   echo -ne "checking md5sum (${count_current}/${count_total}): "
2793   ( cd ${PKGDIR}; md5sum -c ${md5file}) || die "md5 for ${pkgfile} failed"   mchecksum --rundir "${PKGDIR}" --file "${md5file}" --method md5 || die "md5 for ${pkgfile} failed"
2794   else   else
2795   echo -ne "${COLBLUE} --- ${COLDEFAULT}"   echo -ne "${COLBLUE} --- ${COLDEFAULT}"
2796   echo -e "!! no md5sum file found for ${pkgfile} :("   echo -e "!! no md5sum file found for ${pkgfile} :("
# Line 2999  pkgsearch() Line 3030  pkgsearch()
3030   local state   local state
3031   local descriptiom   local descriptiom
3032   local homepage   local homepage
3033     local license
3034   local i   local i
3035   local all_installed   local all_installed
3036   local ipver   local ipver
# Line 3035  pkgsearch() Line 3067  pkgsearch()
3067   state="$(get_value_from_magefile STATE ${magefile})"   state="$(get_value_from_magefile STATE ${magefile})"
3068   description="$(get_value_from_magefile DESCRIPTION ${magefile})"   description="$(get_value_from_magefile DESCRIPTION ${magefile})"
3069   homepage="$(get_value_from_magefile HOMEPAGE ${magefile})"   homepage="$(get_value_from_magefile HOMEPAGE ${magefile})"
3070     license="$(get_value_from_magefile LICENSE ${magefile})"
3071    
3072   # all installed   # all installed
3073   for i in $(get_uninstall_candidates --pname ${pname} --pcat ${pcat})   for i in $(get_uninstall_candidates --pname ${pname} --pcat ${pcat})
3074   do   do
3075   ipver="$(magename2pver ${i})"   ipver="$(magename2pver ${i})"
3076   ipbuild="$(magename2pbuild ${i})"   ipbuild="$(magename2pbuild ${i})"
3077    
3078   if [[ -z ${all_installed} ]]   if [[ -z ${all_installed} ]]
3079   then   then
3080   all_installed="${ipver}-${ipbuild}"   all_installed="${ipver}-${ipbuild}"
# Line 3050  pkgsearch() Line 3083  pkgsearch()
3083   fi   fi
3084   done   done
3085   [[ -z ${all_installed} ]] && all_installed="none"   [[ -z ${all_installed} ]] && all_installed="none"
3086    
3087   case ${state} in   case ${state} in
3088   stable) state=${COLGREEN}"[s] ";;   stable) state=${COLGREEN}"[s] ";;
3089   testing) state=${COLYELLOW}"[t] ";;   testing) state=${COLYELLOW}"[t] ";;
# Line 3095  EOF Line 3128  EOF
3128   echo "      Installed versions: ${all_installed}"   echo "      Installed versions: ${all_installed}"
3129   echo "      Description: ${description}"   echo "      Description: ${description}"
3130   echo "      Homepage: ${homepage}"   echo "      Homepage: ${homepage}"
3131     if [[ ! -z ${license} ]]
3132     then
3133     echo "      License:  ${license}"
3134     fi
3135   echo "      Depends: ${deps}"   echo "      Depends: ${deps}"
3136   echo "      SDepends: ${sdeps}"   echo "      SDepends: ${sdeps}"
3137   echo   echo
# Line 3285  known_mage_feature() Line 3322  known_mage_feature()
3322   ccache|!ccache) retval=0 ;;   ccache|!ccache) retval=0 ;;
3323   check|!check) retval=0 ;;   check|!check) retval=0 ;;
3324   compressdoc|!compressdoc) retval=0 ;;   compressdoc|!compressdoc) retval=0 ;;
3325     debug|!debug) retval=0 ;;
3326   distcc|!distcc) retval=0 ;;   distcc|!distcc) retval=0 ;;
3327   kernelsrcunpack|!kernelsrcunpack) retval=0 ;;   kernelsrcunpack|!kernelsrcunpack) retval=0 ;;
3328   libtool|!libtool) retval=0 ;;   libtool|!libtool) retval=0 ;;
3329   linuxsymlink|!linuxsymlink) retval=0 ;;   linuxsymlink|!linuxsymlink) retval=0 ;;
3330   pkgbuild|!pkgbuild) retval=0 ;;   pkgbuild|!pkgbuild) retval=0 ;;
3331     pkgdistrotag|!pkgdistrotag) retval=0 ;;
3332   purge|!purge) retval=0 ;;   purge|!purge) retval=0 ;;
3333   qalint|!qalint) retval=0 ;;   qalint|!qalint) retval=0 ;;
3334   regentree|!regentree) retval=0 ;;   regentree|!regentree) retval=0 ;;
3335   stepbystep|!stepbystep) retval=0 ;;   resume|!resume) retval=0 ;;
3336   srcpkgbuild|!srcpkgbuild) retval=0 ;;   srcpkgbuild|!srcpkgbuild) retval=0 ;;
3337   srcpkgtarball|!srcpkgtarball) retval=0 ;;   srcpkgtarball|!srcpkgtarball) retval=0 ;;
3338     static|!static) retval=0 ;;
3339     stepbystep|!stepbystep) retval=0 ;;
3340   strip|!strip) retval=0 ;;   strip|!strip) retval=0 ;;
3341     verbose|!verbose) retval=0 ;;
3342   *) retval=1 ;;   *) retval=1 ;;
3343   esac   esac
3344    
# Line 3305  known_mage_feature() Line 3347  known_mage_feature()
3347    
3348  load_mage_features()  load_mage_features()
3349  {  {
  echo -en "${COLBLUE}---${COLGREEN} Loading mage-features... ${COLDEFAULT}"  
3350   for i in ${MAGE_FEATURES_GLOBAL[*]} ${MAGE_FEATURES[*]}   for i in ${MAGE_FEATURES_GLOBAL[*]} ${MAGE_FEATURES[*]}
3351   do   do
3352   FVERBOSE=off msetfeature ${i}   FVERBOSE=off msetfeature ${i}
3353   done   done
   
  echo -e "${COLGREEN}done${COLDEFAULT}"  
3354  }  }
3355    
3356  msetfeature()  msetfeature()
# Line 3328  msetfeature() Line 3367  msetfeature()
3367    
3368   if ! known_mage_feature "${feature}"   if ! known_mage_feature "${feature}"
3369   then   then
3370   [[ ${FVERBOSE} = off ]] || echo "unkown feature ${feature}, ignoring it"   [[ ${FVERBOSE} = off ]] || echo -e "${COLRED}Unknown feature '${feature}', ignoring it${COLDEFAULT}"
3371   return 3   return 3
3372   fi   fi
3373    
# Line 3381  mqueryfeature() Line 3420  mqueryfeature()
3420   fi   fi
3421   done   done
3422   else   else
3423     [[ ${FVERBOSE} = off ]] || echo -e "${COLRED}Unknown feature '${feature}', ignoring it${COLDEFAULT}"
3424   retval=3   retval=3
3425   fi   fi
3426    

Legend:
Removed from v.1599  
changed lines
  Added in v.1654