#!/bin/bash # Updates the timestamp and contents in a package's .project # if $1 is null, update pkgusr's pkg pkg="$1" if [ -z "${pkg}" ]; then pkg=$(whoami) fi pkgdir=/usr/src/${pkg} sed -i "s/\(Last_Updated: \).*$/\1$(date +%c)/" ${pkgdir}/.project awk '/^CONTENTS:/ { print; exit; } {print}' ${pkgdir}/.project > ${pkgdir}/.projtmp echo "--------" >> ${pkgdir}/.projtmp list_package ${pkg} >> ${pkgdir}/.projtmp mv ${pkgdir}/.projtmp ${pkgdir}/.project # If we're root, chown the .project file [[ $(id -u) -eq 0 ]] && chown -v ${pkg}:${pkg} ${pkgdir}/.project