Magellan Linux

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

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

revision 1675 by niro, Mon Feb 6 09:45:23 2012 UTC revision 1963 by niro, Fri Oct 26 21:14:51 2012 UTC
# Line 171  fix_mtime() Line 171  fix_mtime()
171   mtime=$(stat -c %Y "${reference}")   mtime=$(stat -c %Y "${reference}")
172   touch \   touch \
173   --no-create \   --no-create \
174     --no-dereference \
175   --time=mtime \   --time=mtime \
176   --reference "${reference}" \   --reference="${reference}" \
177   "${pathto}"   "${pathto}"
178    
179   echo "${mtime}"   echo "${mtime}"
# Line 414  install_symlinks() Line 415  install_symlinks()
415    
416   ln -snf "${link}" "${MROOT}${pathto}"   ln -snf "${link}" "${MROOT}${pathto}"
417    
418  # # fix mtime and db   # fix mtime and db
419  # fix_descriptor ${pkgname}/.symlinks \   fix_descriptor ${pkgname}/.symlinks \
420  # "${pathto}" \   "${pathto}" \
421  # "${posix}" \   "${posix}" \
422  # "${link}" \   "${link}" \
423  # "$(fix_mtime "${BUILDDIR}/${pkgname}"/.mtime \   "$(fix_mtime "${BUILDDIR}/${pkgname}"/.mtime \
424  # "${MROOT}${pathto}")"   "${MROOT}${pathto}")"
425    
426   done < ${BUILDDIR}/${pkgname}/.symlinks   done < ${BUILDDIR}/${pkgname}/.symlinks
427    
# Line 807  compare_mtime() Line 808  compare_mtime()
808    
809   mtime="$(stat -c %Y ${MROOT}${INSTALLDB}/${pfull}/.mtime)"   mtime="$(stat -c %Y ${MROOT}${INSTALLDB}/${pfull}/.mtime)"
810    
811   # if $pathto is a symlink than compare linked binary   # no extra handlink for symlinks anymore as fix_mtime
812   if [ -L "${MROOT}${pathto}" ]   # uses --no-dereference, compare directly
813   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  
814    
815   [[ ${mtime} = ${x} ]] && return 0   [[ ${mtime} = ${x} ]] && return 0
816    
# Line 1615  syncmage_tarball() Line 1605  syncmage_tarball()
1605   then   then
1606   if ! mcheckemptydir ${MAGEDIR}   if ! mcheckemptydir ${MAGEDIR}
1607   then   then
1608   find ${MAGEDIR} -mindepth 1 -maxdepth 1 | xarg --no-run-if-empty rm -r   find ${MAGEDIR} -mindepth 1 -maxdepth 1 | xargs --no-run-if-empty rm -r
1609   fi   fi
1610   else   else
1611   rm -rf ${MAGEDIR}   rm -rf ${MAGEDIR}
# Line 1880  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     # hack; do not honor a global set IFS like '§'
1878     local IFS
1879    
1880   declare -i count=0   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   done
1889   (( count ++ ))  
1890     # convert 0001 -> 1; 0120 -> 120 etc
1891     # use bash internal base functions to this task
1892     x="$((10#${count}))"
1893     for (( i=0; i<x; i++ ))
1894     do
1895     if [[ ${count:${i}:1} != 0 ]]
1896     then
1897     count="${count:${i}}"
1898     break
1899     fi
1900     done
1901    
1902     count="$(( ${count}+1 ))"
1903    
1904   # fill output up with zeros   # fill output up with zeros
1905   for (( i=${#count}; i < 4; i++ )); do output="${output}0"; done   for (( i=${#count}; i < 4; i++ )); do output="${output}0"; done
# Line 3112  pkgsearch() Line 3120  pkgsearch()
3120   "") continue;;   "") continue;;
3121   esac   esac
3122    
3123   deps="${deps} $(basename ${dep%-*})"   if [[ -z ${deps} ]]
3124     then
3125     deps="$(basename ${dep%-*})"
3126     else
3127     deps="${deps} $(basename ${dep%-*})"
3128     fi
3129   done << EOF   done << EOF
3130  ${depsfull}  ${depsfull}
3131  EOF  EOF
# Line 3123  EOF Line 3136  EOF
3136   "") continue;;   "") continue;;
3137   esac   esac
3138    
3139   sdeps="${sdeps} $(basename ${dep%-*})"   if [[ -z ${sdeps} ]]
3140     then
3141     sdeps="$(basename ${dep%-*})"
3142     else
3143     sdeps="${sdeps} $(basename ${dep%-*})"
3144     fi
3145   done << EOF   done << EOF
3146  ${sdepsfull}  ${sdepsfull}
3147  EOF  EOF
# Line 3137  EOF Line 3155  EOF
3155   then   then
3156   echo "      License:  ${license}"   echo "      License:  ${license}"
3157   fi   fi
3158   echo "      Depends: ${deps}"   echo "      Depends:  ${deps}"
3159   echo "      SDepends: ${sdeps}"   echo "      SDepends: ${sdeps}"
3160   echo   echo
3161    
# Line 3254  EOF Line 3272  EOF
3272  need_busybox_support()  need_busybox_support()
3273  {  {
3274   local cmd   local cmd
3275     local busybox
3276   cmd="$1"   cmd="$1"
3277    
3278   if [[ -x /bin/busybox ]]   for busybox in {,/usr}/bin/busybox
3279   then   do
3280   if [[ $(readlink $(which ${cmd})) = /bin/busybox ]]   if [[ -x ${busybox} ]]
3281   then   then
3282   # needs busybox support   if [[ $(readlink $(which ${cmd})) = ${busybox} ]]
3283   return 0   then
3284     # needs busybox support
3285     return 0
3286     fi
3287   fi   fi
3288   fi   done
3289    
3290   # no busybox   # no busybox
3291   return 1   return 1
# Line 3434  mqueryfeature() Line 3456  mqueryfeature()
3456    
3457  mprintfeatures()  mprintfeatures()
3458  {  {
3459   echo "Global features:  ${MAGE_FEATURES_GLOBAL[*]}"   echo -e "${COLRED}Global features:${COLDEFAULT} ${MAGE_FEATURES_GLOBAL[*]}"
3460   echo "Local features:   ${MAGE_FEATURES[*]}"   echo -e "${COLYELLOW}Local features:${COLDEFAULT} ${MAGE_FEATURES[*]}"
3461   echo "Current features: ${MAGE_FEATURES_CURRENT[*]}"   echo -e "${COLGREEN}Current features:${COLDEFAULT} ${MAGE_FEATURES_CURRENT[*]}"
3462  }  }

Legend:
Removed from v.1675  
changed lines
  Added in v.1963