Magellan Linux

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

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

revision 1654 by niro, Fri Jan 13 23:20:39 2012 UTC revision 1962 by niro, Thu Oct 25 07:17:17 2012 UTC
# Line 72  mchecksum() Line 72  mchecksum()
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 170  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 413  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 806  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 1564  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 1875  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     # 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   done
1901   (( count ++ ))  
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 3107  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 3118  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 3132  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 3249  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 3429  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.1654  
changed lines
  Added in v.1962