1 #!/bin/sh 2 3 PROGNAME=`basename "$0"` 4 5 if [ "$1" = '--help' ] || [ ! "$1" ] || [ ! -e "$1" ] ; then 6 cat 1>&2 <<EOF 7 Usage: $PROGNAME <package location> 8 9 Search for package declarations in the given package, overwriting the Control 10 file for the package with an updated version. 11 EOF 12 exit 1 13 fi 14 15 PACKAGE="$1" 16 17 # Obtain the existing Control file and extract the non-provides fields. 18 19 grep -v '^provides: ' "$PACKAGE/Control" > _non_provides.tmp 20 21 # Search for package declarations and build provides fields. 22 23 grep PC_FILENAME -r "$PACKAGE" | cut -d'=' -f 2 | sort -u | sed 's/^ /provides: /' > _provides.tmp 24 25 # Concatenate the files and overwrite the Control file. 26 27 cat _provides.tmp _non_provides.tmp > "$PACKAGE/Control" 28 29 # Remove the temporary files. 30 31 rm _provides.tmp _non_provides.tmp