--- trunk/mage/usr/lib/mage/mage4.functions.sh 2012/02/06 09:45:23 1675 +++ trunk/mage/usr/lib/mage/mage4.functions.sh 2012/10/26 21:14:51 1963 @@ -171,8 +171,9 @@ mtime=$(stat -c %Y "${reference}") touch \ --no-create \ + --no-dereference \ --time=mtime \ - --reference "${reference}" \ + --reference="${reference}" \ "${pathto}" echo "${mtime}" @@ -414,13 +415,13 @@ ln -snf "${link}" "${MROOT}${pathto}" -# # fix mtime and db -# fix_descriptor ${pkgname}/.symlinks \ -# "${pathto}" \ -# "${posix}" \ -# "${link}" \ -# "$(fix_mtime "${BUILDDIR}/${pkgname}"/.mtime \ -# "${MROOT}${pathto}")" + # fix mtime and db + fix_descriptor ${pkgname}/.symlinks \ + "${pathto}" \ + "${posix}" \ + "${link}" \ + "$(fix_mtime "${BUILDDIR}/${pkgname}"/.mtime \ + "${MROOT}${pathto}")" done < ${BUILDDIR}/${pkgname}/.symlinks @@ -807,20 +808,9 @@ mtime="$(stat -c %Y ${MROOT}${INSTALLDB}/${pfull}/.mtime)" - # if $pathto is a symlink than compare linked binary - if [ -L "${MROOT}${pathto}" ] - then - # 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 + # no extra handlink for symlinks anymore as fix_mtime + # uses --no-dereference, compare directly + x=$(stat -c %Y "${MROOT}${pathto}") [[ ${mtime} = ${x} ]] && return 0 @@ -1615,7 +1605,7 @@ then if ! mcheckemptydir ${MAGEDIR} then - 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 fi else rm -rf ${MAGEDIR} @@ -1880,18 +1870,36 @@ local filename="${file##*/}" local count local output + local oldprotected local i + local x + + # hack; do not honor a global set IFS like '§' + local IFS - declare -i count=0 + count=0 # check if there are already protected files - for oldpretected in $(find ${dirname} -iname "._cfg????_${filename}" | + for oldprotected in $(find ${dirname} -iname "._cfg????_${filename}" | sed -e "s:\(^.*/\)\(._cfg*_\)\(/.*$\):\1\2\3\%\2\%\3:" | sort -t'%' -k3 -k2 | cut -f1 -d'%') do - count=$(echo ${oldpretected} | cut -d_ -f2 | sed -e "s:cfg::") + count="$(echo ${oldprotected} | sed 's:.*\/._cfg\(.*\)_.*:\1:')" done - (( count ++ )) + + # convert 0001 -> 1; 0120 -> 120 etc + # use bash internal base functions to this task + x="$((10#${count}))" + for (( i=0; i