Magellan Linux

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

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

revision 1658 by niro, Sat Jan 14 00:00:53 2012 UTC revision 1961 by niro, Thu Oct 25 07:07:28 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 1565  syncmage_tarball() Line 1555  syncmage_tarball()
1555    
1556   for mirr in ${MIRRORS}   for mirr in ${MIRRORS}
1557   do   do
1558   # path without distribution   # path without distribution
1559   mymirr="${mirr%/*}"   # (only for stable|testing|unstable and not DISTROTAG)
1560     case ${mirr##*/} in
1561     stable|testing|unstable) mymirr="${mirr%/*}";;
1562     *) mymirr="${mirr}";;
1563     esac
1564    
1565   echo -ne "${COLBLUE} --- ${COLDEFAULT}"   echo -ne "${COLBLUE} --- ${COLDEFAULT}"
1566   echo "fetching latest md5 from ${mymirr} ..."   echo "fetching latest md5 from ${mymirr} ..."
# Line 1876  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 3108  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 3119  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 3133  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 3250  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 3430  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.1658  
changed lines
  Added in v.1961