Magellan Linux

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

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

revision 1690 by niro, Thu Feb 16 12:00:59 2012 UTC revision 1961 by niro, Thu Oct 25 07:07:28 2012 UTC
# Line 1870  count_protected_files() Line 1870  count_protected_files()
1870   local filename="${file##*/}"   local filename="${file##*/}"
1871   local count   local count
1872   local output   local output
1873     local oldprotected
1874   local i   local i
1875     local x
1876    
1877   declare -i count=0   # hack; do not honor a global set IFS like '§'
1878     local IFS
1879    
1880     count=0
1881    
1882   # check if there are already protected files   # check if there are already protected files
1883   for oldpretected in $(find ${dirname} -iname "._cfg????_${filename}" |   for oldprotected in $(find ${dirname} -iname "._cfg????_${filename}" |
1884   sed -e "s:\(^.*/\)\(._cfg*_\)\(/.*$\):\1\2\3\%\2\%\3:" |   sed -e "s:\(^.*/\)\(._cfg*_\)\(/.*$\):\1\2\3\%\2\%\3:" |
1885   sort -t'%' -k3 -k2 | cut -f1 -d'%')   sort -t'%' -k3 -k2 | cut -f1 -d'%')
1886   do   do
1887   count=$(echo ${oldpretected} | cut -d_ -f2 | sed -e "s:cfg::")   count="$(echo ${oldprotected} | sed 's:.*\/._cfg\(.*\)_.*:\1:')"
1888     done
1889    
1890     # dirty hack to convert 0001 -> 1; 0120 -> 120 etc
1891     x="${#count}"
1892     for (( i=0; i<x; i++ ))
1893     do
1894     if [[ ${count:${i}:1} != 0 ]]
1895     then
1896     count="${count:${i}}"
1897     break
1898     fi
1899   done   done
1900   (( count ++ ))  
1901     count="$(( ${count}+1 ))"
1902    
1903   # fill output up with zeros   # fill output up with zeros
1904   for (( i=${#count}; i < 4; i++ )); do output="${output}0"; done   for (( i=${#count}; i < 4; i++ )); do output="${output}0"; done
# Line 3102  pkgsearch() Line 3119  pkgsearch()
3119   "") continue;;   "") continue;;
3120   esac   esac
3121    
3122   deps="${deps} $(basename ${dep%-*})"   if [[ -z ${deps} ]]
3123     then
3124     deps="$(basename ${dep%-*})"
3125     else
3126     deps="${deps} $(basename ${dep%-*})"
3127     fi
3128   done << EOF   done << EOF
3129  ${depsfull}  ${depsfull}
3130  EOF  EOF
# Line 3113  EOF Line 3135  EOF
3135   "") continue;;   "") continue;;
3136   esac   esac
3137    
3138   sdeps="${sdeps} $(basename ${dep%-*})"   if [[ -z ${sdeps} ]]
3139     then
3140     sdeps="$(basename ${dep%-*})"
3141     else
3142     sdeps="${sdeps} $(basename ${dep%-*})"
3143     fi
3144   done << EOF   done << EOF
3145  ${sdepsfull}  ${sdepsfull}
3146  EOF  EOF
# Line 3127  EOF Line 3154  EOF
3154   then   then
3155   echo "      License:  ${license}"   echo "      License:  ${license}"
3156   fi   fi
3157   echo "      Depends: ${deps}"   echo "      Depends:  ${deps}"
3158   echo "      SDepends: ${sdeps}"   echo "      SDepends: ${sdeps}"
3159   echo   echo
3160    
# Line 3244  EOF Line 3271  EOF
3271  need_busybox_support()  need_busybox_support()
3272  {  {
3273   local cmd   local cmd
3274     local busybox
3275   cmd="$1"   cmd="$1"
3276    
3277   if [[ -x /bin/busybox ]]   for busybox in {,/usr}/bin/busybox
3278   then   do
3279   if [[ $(readlink $(which ${cmd})) = /bin/busybox ]]   if [[ -x ${busybox} ]]
3280   then   then
3281   # needs busybox support   if [[ $(readlink $(which ${cmd})) = ${busybox} ]]
3282   return 0   then
3283     # needs busybox support
3284     return 0
3285     fi
3286   fi   fi
3287   fi   done
3288    
3289   # no busybox   # no busybox
3290   return 1   return 1
# Line 3424  mqueryfeature() Line 3455  mqueryfeature()
3455    
3456  mprintfeatures()  mprintfeatures()
3457  {  {
3458   echo "Global features:  ${MAGE_FEATURES_GLOBAL[*]}"   echo -e "${COLRED}Global features:${COLDEFAULT} ${MAGE_FEATURES_GLOBAL[*]}"
3459   echo "Local features:   ${MAGE_FEATURES[*]}"   echo -e "${COLYELLOW}Local features:${COLDEFAULT} ${MAGE_FEATURES[*]}"
3460   echo "Current features: ${MAGE_FEATURES_CURRENT[*]}"   echo -e "${COLGREEN}Current features:${COLDEFAULT} ${MAGE_FEATURES_CURRENT[*]}"
3461  }  }

Legend:
Removed from v.1690  
changed lines
  Added in v.1961