ipkg-remove 373 B

1234567891011121314151617181920
  1. #!/usr/bin/env bash
  2. sourcename="$1"; shift
  3. for pkg in "$@"; do
  4. tar -Ozxf "$pkg" ./control.tar.gz 2>/dev/null | tar -Ozxf - ./control 2>/dev/null | \
  5. while read field value; do
  6. if [ "$field" = "SourceName:" ] && [ "$value" = "$sourcename" ]; then
  7. rm -vf "$pkg"
  8. break
  9. fi
  10. done
  11. case "$pkg" in
  12. */"${sourcename}_"*.ipk)
  13. rm -vf "$pkg"
  14. ;;
  15. esac
  16. done
  17. exit 0