#!/usr/bin/env bash
sourcename="$1"; shift
for pkg in "$@"; do
tar -Ozxf "$pkg" ./control.tar.gz 2>/dev/null | tar -Ozxf - ./control 2>/dev/null | \
while read field value; do
if [ "$field" = "SourceName:" ] && [ "$value" = "$sourcename" ]; then
rm -vf "$pkg"
break
fi
done
case "$pkg" in
*/"${sourcename}_"*.ipk)
;;
esac
exit 0