#!/bin/bash SEARCH="$1" [ "$1" ] || exit 1 if ! [ -e .pkgfiles ] || [ "$SEARCH" == '--update' ]; then rm .pkgfiles.tmp 2>/dev/null echo "creating filelist..." find -type f -name '*.pkg' | while read F; do echo "indexing $F" tar -tzf "$F" 2>/dev/null|sed "s@^@$F: @" >> .pkgfiles.tmp done mv .pkgfiles.tmp .pkgfiles fi [ "$SEARCH" == "--update" ] && exit 0 grep "$SEARCH" .pkgfiles