3 # Updates the timestamp and contents in a package's .project
4 # if $1 is null, update pkgusr's pkg
8 if [ -z "${pkg}" ]; then
12 pkgdir=/usr/src/${pkg}
13 pkgawk=/usr/lib/pkgusr/pkgdeps.awk
17 for file in $(forall_direntries_from $pkg -type f -executable -readable); do
18 if readelf -d $file &>/dev/null && ldd $file &>/dev/null; then
19 (readelf -d $file ; ldd $file ) |
20 awk -f ${pkgawk} | xargs stat --printf "%U:%G\n"
22 done|sort -u|tr -s '\n' ' '
25 # Update deps and date
28 DEPS=${DEPS% } # trailing whitespace begone!
29 sed -i -e "s/\(Last_Updated: \).*$/\1${TIMESTAMP}/" \
30 -e s/"\(Deps: \).*$"/"\1${DEPS}"/ ${pkgdir}/.project
32 # Clear out old file list
33 awk '/^CONTENTS:/ { print; exit; } {print}' \
34 ${pkgdir}/.project > ${pkgdir}/.projtmp
35 echo "--------" >> ${pkgdir}/.projtmp
37 # Add up to date file list
38 list_package ${pkg} >> ${pkgdir}/.projtmp
39 mv ${pkgdir}/.projtmp ${pkgdir}/.project
41 # If we're root, chown the .project file
42 [[ $(id -u) -eq 0 ]] && chown -v ${pkg}:${pkg} ${pkgdir}/.project