summaryrefslogtreecommitdiffstats
path: root/scripts/ipkg-remove
blob: f4957004c0ebcabba2b8d301c2888e555929f38b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/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