ayaports/.forgejo/bin/clear-repo.sh

18 lines
495 B
Bash
Raw Permalink Normal View History

2024-12-01 18:39:18 +00:00
#!/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