#!/bin/sh TARGET_REPO=$1 ARCH=$2 curl --silent $TARGET_REPO/$ARCH/APKINDEX.tar.gz | tar -O -zx APKINDEX > APKINDEX pkgs=$(awk -F ':' '{if($1=="o"){print $2}}' APKINDEX | sort | uniq) for pkg in $pkgs; do pkgvers=$(sed -n "/^P:$pkg$/,/^$/p" APKINDEX | awk -F ':' '{if($1=="V"){print $2}}') for pkgver in $pkgvers; do echo "Deleting $pkg-$pkgver of arch $ARCH from $TARGET_REPO" curl -s --user $FORGE_REPO_USER:$FORGE_REPO_TOKEN -X DELETE $TARGET_REPO/$ARCH/$pkg-$pkgver.apk done done