forgejo-ci: add clear-repo binary
This commit is contained in:
parent
89c8805846
commit
b8f608772c
1 changed files with 17 additions and 0 deletions
17
.forgejo/bin/clear-repo.sh
Executable file
17
.forgejo/bin/clear-repo.sh
Executable file
|
@ -0,0 +1,17 @@
|
|||
#!/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
|
Loading…
Reference in a new issue