tools/squashfskit: fix version detection on non-linux system
[openwrt/staging/wigyori.git] / scripts / ipkg-remove
1 #!/usr/bin/env bash
2
3 sourcename="$1"; shift
4
5 for pkg in "$@"; do
6 tar -Ozxf "$pkg" ./control.tar.gz 2>/dev/null | tar -Ozxf - ./control 2>/dev/null | \
7 while read field value; do
8 if [ "$field" = "SourceName:" ] && [ "$value" = "$sourcename" ]; then
9 rm -vf "$pkg"
10 break
11 fi
12 done
13 case "$pkg" in
14 */"${sourcename}_"*.ipk)
15 rm -vf "$pkg"
16 ;;
17 esac
18 done
19
20 exit 0