openwrt/scripts/ipkg-remove

21 lines
373 B
Plaintext
Raw Permalink Normal View History

#!/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)
rm -vf "$pkg"
;;
esac
done
exit 0