Magellan Linux

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

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

revision 1584 by niro, Wed Dec 28 12:23:50 2011 UTC revision 2224 by niro, Wed Oct 16 07:46:58 2013 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} ]]
73   then   then
74   pushd ${rundir} &> /dev/null   pushd ${rundir} &> /dev/null
75   ${cmd} -c ${file} &> /dev/null   # be verbose here
76     ${cmd} -c ${file} #&> /dev/null
77   retval="$?"   retval="$?"
78   popd &> /dev/null   popd &> /dev/null
79   else   else
# Line 82  mchecksum() Line 83  mchecksum()
83   return "${retval}"   return "${retval}"
84  }  }
85    
86    mcheckemptydir()
87    {
88     local dir="$1"
89     local retval=1
90    
91     if [[ ! -d ${dir} ]]
92     then
93     echo "mcheckemptydir(): '${dir}' is not a directory!"
94     retval=3
95     else
96     shopt -s nullglob dotglob
97     files=( ${dir}/* )
98     (( ${#files[*]} )) || retval=0
99     shopt -u nullglob dotglob
100     fi
101    
102     return ${retval}
103    }
104    
105    unpack_package()
106    {
107     local magefile="$1"
108     local pkg
109     local pkgtype
110     local tar_opts
111    
112     pkg="$(get_value_from_magefile PKGNAME ${magefile}).${PKGSUFFIX}"
113     pkgtype="$(get_value_from_magefile PKGTYPE ${magefile})"
114    
115     xtitle "[ Unpacking ${pkg} ]"
116    
117     # abort on virtual pkg
118     if [[ ${pkgtype} = virtual ]]
119     then
120     echo -ne " ${COLBLUE}---${COLDEFAULT}"
121     echo " !unpack virtual ${pkg/.${PKGSUFFIX}/} ... "
122     continue
123     fi
124    
125     # abort on sources pkg
126     if [[ ${pkgtype} = sources ]]
127     then
128     echo -ne " ${COLBLUE}---${COLDEFAULT}"
129     echo " !unpack sources ${pkg/.${PKGSUFFIX}/} ... "
130     continue
131     fi
132    
133     # busybox?
134     if need_busybox_support tar
135     then
136     tar_opts="xjf"
137     else
138     tar_opts="xjmf"
139     fi
140    
141     echo -e " ${COLBLUE}***${COLDEFAULT} unpacking ${pkg} ... "
142     tar ${tar_opts} ${PKGDIR}/${pkg} -C ${BUILDDIR} || die "Unpacking package ${pkg}"
143    }
144    
145  unpack_packages()  unpack_packages()
146  {  {
147   local list="$@"   local list="$@"
148   local magefile   local magefile
  local pkg  
  local pkgtype  
149   local count_current   local count_current
150   local count_total   local count_total
151   local tar_opts   local tar_opts
# Line 100  unpack_packages() Line 158  unpack_packages()
158    
159   for magefile in ${list}   for magefile in ${list}
160   do   do
161   pkg="$(get_value_from_magefile PKGNAME ${magefile}).${PKGSUFFIX}"   unpack_package "${magefile}"
  pkgtype="$(get_value_from_magefile PKGTYPE ${magefile})"  
   
162   (( count_current++ ))   (( count_current++ ))
  xtitle "[ (${count_current}/${count_total}) Unpacking ${pkg} ]"  
   
  # abort on virtual pkg  
  if [[ ${pkgtype} = virtual ]]  
  then  
  echo -ne " ${COLBLUE}---${COLDEFAULT}"  
  echo " !unpack virtual (${count_current}/${count_total}): ${pkg/.${PKGSUFFIX}/} ... "  
  continue  
  fi  
   
  # abort on sources pkg  
  if [[ ${pkgtype} = sources ]]  
  then  
  echo -ne " ${COLBLUE}---${COLDEFAULT}"  
  echo " !unpack sources (${count_current}/${count_total}): ${pkg/.${PKGSUFFIX}/} ... "  
  continue  
  fi  
   
  # busybox?  
  if need_busybox_support tar  
  then  
  tar_opts="xjf"  
  else  
  tar_opts="xjmf"  
  fi  
   
  echo -e " ${COLBLUE}***${COLDEFAULT} unpacking (${count_current}/${count_total}): ${pkg} ... "  
  tar ${tar_opts} ${PKGDIR}/${pkg} -C ${BUILDDIR} || die "Unpacking package ${pkg}"  
163   done   done
164    
165   # add a crlf for a better view   # add a crlf for a better view
# Line 151  fix_mtime() Line 179  fix_mtime()
179   mtime=$(stat -c %Y "${reference}")   mtime=$(stat -c %Y "${reference}")
180   touch \   touch \
181   --no-create \   --no-create \
182     --no-dereference \
183   --time=mtime \   --time=mtime \
184   --reference "${reference}" \   --reference="${reference}" \
185   "${pathto}"   "${pathto}"
186    
187   echo "${mtime}"   echo "${mtime}"
# Line 394  install_symlinks() Line 423  install_symlinks()
423    
424   ln -snf "${link}" "${MROOT}${pathto}"   ln -snf "${link}" "${MROOT}${pathto}"
425    
426  # # fix mtime and db   # fix mtime and db
427  # fix_descriptor ${pkgname}/.symlinks \   fix_descriptor ${pkgname}/.symlinks \
428  # "${pathto}" \   "${pathto}" \
429  # "${posix}" \   "${posix}" \
430  # "${link}" \   "${link}" \
431  # "$(fix_mtime "${BUILDDIR}/${pkgname}"/.mtime \   "$(fix_mtime "${BUILDDIR}/${pkgname}"/.mtime \
432  # "${MROOT}${pathto}")"   "${MROOT}${pathto}")"
433    
434   done < ${BUILDDIR}/${pkgname}/.symlinks   done < ${BUILDDIR}/${pkgname}/.symlinks
435    
# Line 787  compare_mtime() Line 816  compare_mtime()
816    
817   mtime="$(stat -c %Y ${MROOT}${INSTALLDB}/${pfull}/.mtime)"   mtime="$(stat -c %Y ${MROOT}${INSTALLDB}/${pfull}/.mtime)"
818    
819   # if $pathto is a symlink than compare linked binary   # no extra handlink for symlinks anymore as fix_mtime
820   if [ -L "${MROOT}${pathto}" ]   # uses --no-dereference, compare directly
821   then   x=$(stat -c %Y "${MROOT}${pathto}")
  # readlink -f resolves full path of linked file  
  x="$(readlink -f "${MROOT}${pathto}")"  
   
  # abort if target does not exists  
  # we keep safe here, theoretically the link can removed  
  [ ! -e "${x}" ] && return 1  
   
  x=$(stat -c %Y "${x}")  
  else  
  x=$(stat -c %Y "${MROOT}${pathto}")  
  fi  
822    
823   [[ ${mtime} = ${x} ]] && return 0   [[ ${mtime} = ${x} ]] && return 0
824    
# Line 1401  mdownload() Line 1419  mdownload()
1419   real_uris="$(convertmirrors ${uri})"   real_uris="$(convertmirrors ${uri})"
1420    
1421   # verbose or not   # verbose or not
1422   mqueryfeature "!verbose" && wget_opts="--quiet"   mqueryfeature "!verbose" && wget_opts+=" --quiet"
1423    
1424   # filter wget options if busybox was found   # filter wget options if busybox was found
1425   wget_opts="$(busybox_filter_wget_options ${WGET_FETCH_OPTIONS})"   wget_opts+=" $(busybox_filter_wget_options ${WGET_FETCH_OPTIONS})"
1426    
1427   # create outputdir   # create outputdir
1428   [[ ! -d ${outputdir} ]] && install -d "${outputdir}"   [[ ! -d ${outputdir} ]] && install -d "${outputdir}"
# Line 1545  syncmage_tarball() Line 1563  syncmage_tarball()
1563    
1564   for mirr in ${MIRRORS}   for mirr in ${MIRRORS}
1565   do   do
1566   # path without distribution   # path without distribution
1567   mymirr="${mirr%/*}"   # (only for stable|testing|unstable and not DISTROTAG)
1568     case ${mirr##*/} in
1569     stable|testing|unstable) mymirr="${mirr%/*}";;
1570     *) mymirr="${mirr}";;
1571     esac
1572    
1573   echo -ne "${COLBLUE} --- ${COLDEFAULT}"   echo -ne "${COLBLUE} --- ${COLDEFAULT}"
1574   echo "fetching latest md5 from ${mymirr} ..."   echo "fetching latest md5 from ${mymirr} ..."
# Line 1579  syncmage_tarball() Line 1601  syncmage_tarball()
1601   else   else
1602   echo -ne "${COLBLUE} --- ${COLDEFAULT}"   echo -ne "${COLBLUE} --- ${COLDEFAULT}"
1603   echo -n "checking md5sum... "   echo -n "checking md5sum... "
1604   ( 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"
1605   fi   fi
1606    
1607   if [[ -d ${MAGEDIR} ]]   if [[ -d ${MAGEDIR} ]]
1608   then   then
1609   echo -ne "${COLBLUE} --- ${COLDEFAULT}"   echo -ne "${COLBLUE} --- ${COLDEFAULT}"
1610   echo "cleaning old mage-tree ${MAGEDIR}..."   echo "cleaning old mage-tree ${MAGEDIR}..."
1611   rm -rf ${MAGEDIR}   # honor mountpoints and empty dirs
1612     if mountpoint -q ${MAGEDIR}
1613     then
1614     if ! mcheckemptydir ${MAGEDIR}
1615     then
1616     find ${MAGEDIR} -mindepth 1 -maxdepth 1 | xargs --no-run-if-empty rm -r
1617     fi
1618     else
1619     rm -rf ${MAGEDIR}
1620     fi
1621   fi   fi
1622    
1623   if need_busybox_support tar   if need_busybox_support tar
# Line 1645  xtitleclean() Line 1676  xtitleclean()
1676  }  }
1677    
1678    
1679  # cuts full pathnames or versionized names down to basename  # unused?
1680  choppkgname()  #
1681  {  # # cuts full pathnames or versionized names down to basename
1682   #we want this only if full name was used  # choppkgname()
1683   if [ -n "$(echo ${MAGENAME}|fgrep .mage)" ]  # {
1684   then  # #we want this only if full name was used
1685   #cuts ARCH and PBUILD  # if [ -n "$(echo ${MAGENAME}|fgrep .mage)" ]
1686   #ARCH comes from ${MAGERC}  # then
1687   MAGENAME=$(echo ${MAGENAME} |sed -e "s:-${ARCH}-r*.::g")  # #cuts ARCH and PBUILD
1688    # #ARCH comes from ${MAGERC}
1689    # MAGENAME=$(echo ${MAGENAME} |sed -e "s:-${ARCH}$(print_distrotag)-r*.::g")
1690    #
1691    # #cuts version number
1692    # MAGENAME=$(basename ${MAGENAME%-*} .mage)
1693    # fi
1694    # }
1695    
  #cuts version number  
  MAGENAME=$(basename ${MAGENAME%-*} .mage)  
  fi  
 }  
1696    
1697  # get_categorie $PNAME, returns CATEGORIE  # get_categorie $PNAME, returns CATEGORIE
1698  # $1=pname  # $1=pname
# Line 1737  get_highest_magefile() Line 1771  get_highest_magefile()
1771   then   then
1772   HIGHEST_MAGEFILE=${magefile}   HIGHEST_MAGEFILE=${magefile}
1773   #for debug only   #for debug only
1774   mqueryfeature "debug" && echo "HIGHEST_MAGEFILE=${HIGHEST_MAGEFILE}"   mqueryfeature "debug" && echo "HIGHEST_MAGEFILE=${HIGHEST_MAGEFILE}" >&2
1775   fi   fi
1776   done   done
1777    
# Line 1844  count_protected_files() Line 1878  count_protected_files()
1878   local filename="${file##*/}"   local filename="${file##*/}"
1879   local count   local count
1880   local output   local output
1881     local oldprotected
1882   local i   local i
1883     local x
1884    
1885     # hack; do not honor a global set IFS like '§'
1886     local IFS
1887    
1888   declare -i count=0   count=0
1889    
1890   # check if there are already protected files   # check if there are already protected files
1891   for oldpretected in $(find ${dirname} -iname "._cfg????_${filename}" |   for oldprotected in $(find ${dirname} -iname "._cfg????_${filename}" |
1892   sed -e "s:\(^.*/\)\(._cfg*_\)\(/.*$\):\1\2\3\%\2\%\3:" |   sed -e "s:\(^.*/\)\(._cfg*_\)\(/.*$\):\1\2\3\%\2\%\3:" |
1893   sort -t'%' -k3 -k2 | cut -f1 -d'%')   sort -t'%' -k3 -k2 | cut -f1 -d'%')
1894   do   do
1895   count=$(echo ${oldpretected} | cut -d_ -f2 | sed -e "s:cfg::")   count="$(echo ${oldprotected} | sed 's:.*\/._cfg\(.*\)_.*:\1:')"
1896   done   done
1897   (( count ++ ))  
1898     # convert 0001 -> 1; 0120 -> 120 etc
1899     # use bash internal base functions to this task
1900     x="$((10#${count}))"
1901     for (( i=0; i<x; i++ ))
1902     do
1903     if [[ ${count:${i}:1} != 0 ]]
1904     then
1905     count="${count:${i}}"
1906     break
1907     fi
1908     done
1909    
1910     count="$(( ${count}+1 ))"
1911    
1912   # fill output up with zeros   # fill output up with zeros
1913   for (( i=${#count}; i < 4; i++ )); do output="${output}0"; done   for (( i=${#count}; i < 4; i++ )); do output="${output}0"; done
# Line 2645  mage_install() Line 2697  mage_install()
2697   if [[ ${PKGTYPE} != virtual ]] && \   if [[ ${PKGTYPE} != virtual ]] && \
2698   [[ ${PKGTYPE} != sources ]]   [[ ${PKGTYPE} != sources ]]
2699   then   then
2700     unpack_package "${magefile}"
2701   echo -e " ${COLBLUE}***${COLDEFAULT} merging files into system ... "   echo -e " ${COLBLUE}***${COLDEFAULT} merging files into system ... "
2702   build_doinstall ${PKGNAME}   build_doinstall ${PKGNAME}
2703   fi   fi
# Line 2759  md5sum_packages() Line 2812  md5sum_packages()
2812   then   then
2813   echo -ne "${COLBLUE} *** ${COLDEFAULT}"   echo -ne "${COLBLUE} *** ${COLDEFAULT}"
2814   echo -ne "checking md5sum (${count_current}/${count_total}): "   echo -ne "checking md5sum (${count_current}/${count_total}): "
2815   ( cd ${PKGDIR}; md5sum -c ${md5file}) || die "md5 for ${pkgfile} failed"   mchecksum --rundir "${PKGDIR}" --file "${md5file}" --method md5 || die "md5 for ${pkgfile} failed"
2816   else   else
2817   echo -ne "${COLBLUE} --- ${COLDEFAULT}"   echo -ne "${COLBLUE} --- ${COLDEFAULT}"
2818   echo -e "!! no md5sum file found for ${pkgfile} :("   echo -e "!! no md5sum file found for ${pkgfile} :("
# Line 2999  pkgsearch() Line 3052  pkgsearch()
3052   local state   local state
3053   local descriptiom   local descriptiom
3054   local homepage   local homepage
3055     local license
3056   local i   local i
3057   local all_installed   local all_installed
3058   local ipver   local ipver
# Line 3035  pkgsearch() Line 3089  pkgsearch()
3089   state="$(get_value_from_magefile STATE ${magefile})"   state="$(get_value_from_magefile STATE ${magefile})"
3090   description="$(get_value_from_magefile DESCRIPTION ${magefile})"   description="$(get_value_from_magefile DESCRIPTION ${magefile})"
3091   homepage="$(get_value_from_magefile HOMEPAGE ${magefile})"   homepage="$(get_value_from_magefile HOMEPAGE ${magefile})"
3092     license="$(get_value_from_magefile LICENSE ${magefile})"
3093    
3094   # all installed   # all installed
3095   for i in $(get_uninstall_candidates --pname ${pname} --pcat ${pcat})   for i in $(get_uninstall_candidates --pname ${pname} --pcat ${pcat})
3096   do   do
3097   ipver="$(magename2pver ${i})"   ipver="$(magename2pver ${i})"
3098   ipbuild="$(magename2pbuild ${i})"   ipbuild="$(magename2pbuild ${i})"
3099    
3100   if [[ -z ${all_installed} ]]   if [[ -z ${all_installed} ]]
3101   then   then
3102   all_installed="${ipver}-${ipbuild}"   all_installed="${ipver}-${ipbuild}"
# Line 3050  pkgsearch() Line 3105  pkgsearch()
3105   fi   fi
3106   done   done
3107   [[ -z ${all_installed} ]] && all_installed="none"   [[ -z ${all_installed} ]] && all_installed="none"
3108    
3109   case ${state} in   case ${state} in
3110   stable) state=${COLGREEN}"[s] ";;   stable) state=${COLGREEN}"[s] ";;
3111   testing) state=${COLYELLOW}"[t] ";;   testing) state=${COLYELLOW}"[t] ";;
# Line 3074  pkgsearch() Line 3129  pkgsearch()
3129   "") continue;;   "") continue;;
3130   esac   esac
3131    
3132   deps="${deps} $(basename ${dep%-*})"   if [[ -z ${deps} ]]
3133     then
3134     deps="$(basename ${dep%-*})"
3135     else
3136     deps="${deps} $(basename ${dep%-*})"
3137     fi
3138   done << EOF   done << EOF
3139  ${depsfull}  ${depsfull}
3140  EOF  EOF
# Line 3085  EOF Line 3145  EOF
3145   "") continue;;   "") continue;;
3146   esac   esac
3147    
3148   sdeps="${sdeps} $(basename ${dep%-*})"   if [[ -z ${sdeps} ]]
3149     then
3150     sdeps="$(basename ${dep%-*})"
3151     else
3152     sdeps="${sdeps} $(basename ${dep%-*})"
3153     fi
3154   done << EOF   done << EOF
3155  ${sdepsfull}  ${sdepsfull}
3156  EOF  EOF
# Line 3095  EOF Line 3160  EOF
3160   echo "      Installed versions: ${all_installed}"   echo "      Installed versions: ${all_installed}"
3161   echo "      Description: ${description}"   echo "      Description: ${description}"
3162   echo "      Homepage: ${homepage}"   echo "      Homepage: ${homepage}"
3163   echo "      Depends: ${deps}"   if [[ ! -z ${license} ]]
3164     then
3165     echo "      License:  ${license}"
3166     fi
3167     echo "      Depends:  ${deps}"
3168   echo "      SDepends: ${sdeps}"   echo "      SDepends: ${sdeps}"
3169   echo   echo
3170    
# Line 3212  EOF Line 3281  EOF
3281  need_busybox_support()  need_busybox_support()
3282  {  {
3283   local cmd   local cmd
3284     local busybox
3285   cmd="$1"   cmd="$1"
3286    
3287   if [[ -x /bin/busybox ]]   for busybox in {,/usr}/bin/busybox
3288   then   do
3289   if [[ $(readlink $(which ${cmd})) = /bin/busybox ]]   if [[ -x ${busybox} ]]
3290   then   then
3291   # needs busybox support   if [[ $(readlink $(type -P ${cmd})) = ${busybox} ]]
3292   return 0   then
3293     # needs busybox support
3294     return 0
3295     fi
3296   fi   fi
3297   fi   done
3298    
3299   # no busybox   # no busybox
3300   return 1   return 1
# Line 3278  known_mage_feature() Line 3351  known_mage_feature()
3351  {  {
3352   local feature="$1"   local feature="$1"
3353   local retval   local retval
3354    
3355   case "${feature}" in   case "${feature}" in
3356   autosvc|!autosvc) retval=0 ;;   autosvc|!autosvc) retval=0 ;;
3357   buildlog|!buildlog) retval=0 ;;   buildlog|!buildlog) retval=0 ;;
3358   ccache|!ccache) retval=0 ;;   ccache|!ccache) retval=0 ;;
3359   check|!check) retval=0 ;;   check|!check) retval=0 ;;
3360   compressdoc|!compressdoc) retval=0 ;;   compressdoc|!compressdoc) retval=0 ;;
3361     debug|!debug) retval=0 ;;
3362   distcc|!distcc) retval=0 ;;   distcc|!distcc) retval=0 ;;
3363     icecc|!icecc) retval=0 ;;
3364   kernelsrcunpack|!kernelsrcunpack) retval=0 ;;   kernelsrcunpack|!kernelsrcunpack) retval=0 ;;
3365   libtool|!libtool) retval=0 ;;   libtool|!libtool) retval=0 ;;
3366   linuxsymlink|!linuxsymlink) retval=0 ;;   linuxsymlink|!linuxsymlink) retval=0 ;;
3367   pkgbuild|!pkgbuild) retval=0 ;;   pkgbuild|!pkgbuild) retval=0 ;;
3368     pkgdistrotag|!pkgdistrotag) retval=0 ;;
3369   purge|!purge) retval=0 ;;   purge|!purge) retval=0 ;;
3370   qalint|!qalint) retval=0 ;;   qalint|!qalint) retval=0 ;;
3371   regentree|!regentree) retval=0 ;;   regentree|!regentree) retval=0 ;;
3372   stepbystep|!stepbystep) retval=0 ;;   resume|!resume) retval=0 ;;
3373   srcpkgbuild|!srcpkgbuild) retval=0 ;;   srcpkgbuild|!srcpkgbuild) retval=0 ;;
3374   srcpkgtarball|!srcpkgtarball) retval=0 ;;   srcpkgtarball|!srcpkgtarball) retval=0 ;;
3375     static|!static) retval=0 ;;
3376     stepbystep|!stepbystep) retval=0 ;;
3377   strip|!strip) retval=0 ;;   strip|!strip) retval=0 ;;
3378     verbose|!verbose) retval=0 ;;
3379   *) retval=1 ;;   *) retval=1 ;;
3380   esac   esac
3381    
# Line 3305  known_mage_feature() Line 3384  known_mage_feature()
3384    
3385  load_mage_features()  load_mage_features()
3386  {  {
  echo "loading mage-features... "  
3387   for i in ${MAGE_FEATURES_GLOBAL[*]} ${MAGE_FEATURES[*]}   for i in ${MAGE_FEATURES_GLOBAL[*]} ${MAGE_FEATURES[*]}
3388   do   do
3389   FVERBOSE=off msetfeature ${i}   FVERBOSE=off msetfeature ${i}
3390   done   done
   
  echo "done"  
3391  }  }
3392    
3393  msetfeature()  msetfeature()
# Line 3328  msetfeature() Line 3404  msetfeature()
3404    
3405   if ! known_mage_feature "${feature}"   if ! known_mage_feature "${feature}"
3406   then   then
3407   [[ ${FVERBOSE} = off ]] || echo "unkown feature ${feature}, ignoring it"   [[ ${FVERBOSE} = off ]] || echo -e "${COLRED}Unknown feature '${feature}', ignoring it${COLDEFAULT}"
3408   return 3   return 3
3409   fi   fi
3410    
# Line 3336  msetfeature() Line 3412  msetfeature()
3412   do   do
3413   if [[ ${MAGE_FEATURES_CURRENT[${i}]} = ${feature} ]]   if [[ ${MAGE_FEATURES_CURRENT[${i}]} = ${feature} ]]
3414   then   then
3415   [[ ${FVERBOSE} = off ]] || echo "feature '${feature}' already enabled"   [[ ${FVERBOSE} = off ]] || echo -e "${COLBLUE}---${COLGREEN} Feature '${feature}' already enabled${COLDEFAULT}"
3416   MAGE_FEATURES_CURRENT[${i}]="${feature}"   MAGE_FEATURES_CURRENT[${i}]="${feature}"
3417   found=1   found=1
3418   elif [[ ${MAGE_FEATURES_CURRENT[${i}]} = !${feature} ]]   elif [[ ${MAGE_FEATURES_CURRENT[${i}]} = !${feature} ]]
3419   then   then
3420   [[ ${FVERBOSE} = off ]] || echo "feature '${feature}' currently disabled, enabling it!"   [[ ${FVERBOSE} = off ]] || echo -e "${COLBLUE}---${COLGREEN} Feature '${feature}' currently disabled, enabling it!${COLDEFAULT}"
3421   MAGE_FEATURES_CURRENT[${i}]="${feature}"   MAGE_FEATURES_CURRENT[${i}]="${feature}"
3422   found=1   found=1
3423   elif [[ ${MAGE_FEATURES_CURRENT[${i}]} = ${feature//!} ]]   elif [[ ${MAGE_FEATURES_CURRENT[${i}]} = ${feature//!} ]]
3424   then   then
3425   [[ ${FVERBOSE} = off ]] || echo "feature '${feature//!}' currently enabled, disabling it!"   [[ ${FVERBOSE} = off ]] || echo -e "${COLBLUE}---${COLGREEN} Feature '${feature//!}' currently enabled, disabling it!${COLDEFAULT}"
3426   MAGE_FEATURES_CURRENT[${i}]="${feature}"   MAGE_FEATURES_CURRENT[${i}]="${feature}"
3427   found=1   found=1
3428   fi   fi
# Line 3356  msetfeature() Line 3432  msetfeature()
3432   # it was not declared. in this case enable it   # it was not declared. in this case enable it
3433   if [[ ${found} = 0 ]]   if [[ ${found} = 0 ]]
3434   then   then
3435   [[ ${FVERBOSE} = off ]] || echo "feature '${feature}' was not declared, enabling it!"   [[ ${FVERBOSE} = off ]] || echo -e "${COLBLUE}---${COLGREEN} Feature '${feature}' was not declared, enabling it!${COLDEFAULT}"
3436   MAGE_FEATURES_CURRENT=( ${MAGE_FEATURES_CURRENT[*]} "${feature}" )   MAGE_FEATURES_CURRENT=( ${MAGE_FEATURES_CURRENT[*]} "${feature}" )
3437   fi   fi
3438    
# Line 3381  mqueryfeature() Line 3457  mqueryfeature()
3457   fi   fi
3458   done   done
3459   else   else
3460     [[ ${FVERBOSE} = off ]] || echo -e "${COLRED}Unknown feature '${feature}', ignoring it${COLDEFAULT}"
3461   retval=3   retval=3
3462   fi   fi
3463    
# Line 3389  mqueryfeature() Line 3466  mqueryfeature()
3466    
3467  mprintfeatures()  mprintfeatures()
3468  {  {
3469   echo "Global features:  ${MAGE_FEATURES_GLOBAL[*]}"   echo -e "${COLRED}Global features:${COLDEFAULT} ${MAGE_FEATURES_GLOBAL[*]}"
3470   echo "Local features:   ${MAGE_FEATURES[*]}"   echo -e "${COLYELLOW}Local features:${COLDEFAULT} ${MAGE_FEATURES[*]}"
3471   echo "Current features: ${MAGE_FEATURES_CURRENT[*]}"   echo -e "${COLGREEN}Current features:${COLDEFAULT} ${MAGE_FEATURES_CURRENT[*]}"
3472  }  }

Legend:
Removed from v.1584  
changed lines
  Added in v.2224