From 051e55778d244d602bf53fec7cef1e6d4d1f0264 Mon Sep 17 00:00:00 2001 From: igorpecovnik Date: Tue, 2 May 2023 12:36:49 +0200 Subject: [PATCH] Enable package repacking for Chromium, Firefox and Thunderbird (#44) Signed-off-by: Igor --- .../workflows/download-and-test-external.yml | 14 +++++- packages/packages-remove.sh | 46 +++++++++++++++++++ 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 packages/packages-remove.sh diff --git a/.github/workflows/download-and-test-external.yml b/.github/workflows/download-and-test-external.yml index 7463c7fc..5274fe64 100644 --- a/.github/workflows/download-and-test-external.yml +++ b/.github/workflows/download-and-test-external.yml @@ -123,7 +123,7 @@ jobs: run: | find os/external/keys/ -type f -name "*.gpg" -exec gpg --import --no-default-keyring --keyring trustedkeys.gpg "{}" \; - sudo apt-get -y install debian-keyring ubuntu-keyring + sudo apt-get -y install debian-keyring ubuntu-keyring devscripts gpg --no-default-keyring --keyring trustedkeys.gpg --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138 0E98404D386FA1D9 - name: Download @@ -182,6 +182,18 @@ jobs: find $SOURCE -type f -name "chromium-codecs-ffmpeg_*" | sort | head -n -2 | xargs sudo rm || true find $SOURCE -type f -name "chromium-codecs-ffmpeg-extra_*" | sort | head -n -2 | xargs sudo rm || true + # repack deb files + DEBS=($(find "${SOURCE}"* -type f -name "thunderbird_*.deb" -o -name "firefox_*.deb" -o -name "chromium*.deb")) + for d in ${DEBS[@]}; do + echo $d + # BEFORE=$(deb-reversion -c ${d} -s armbian) + # add epoch 9 + #AFTER=9:$(echo $BEFORE | cut -d":" -f2) + #echo "$d : $BEFORE -> $AFTER" + #sudo DEBEMAIL=info@armbian.com deb-reversion -v $AFTER -s armbian $d + #sudo rm $d + done + if [[ ${TARGET} == main ]]; then if grep -qE 'B' <<< "$REPOSITORY"; then find $SOURCE -type f -name "*.deb" -exec cp {} build/output/debs-beta/ \;; fi if grep -qE 'S' <<< "$REPOSITORY"; then find $SOURCE -type f -name "*.deb" -exec cp {} build/output/debs/ \;; fi diff --git a/packages/packages-remove.sh b/packages/packages-remove.sh new file mode 100644 index 00000000..91d45c10 --- /dev/null +++ b/packages/packages-remove.sh @@ -0,0 +1,46 @@ +# You need admin:org token capabilities +# NAME = tag you want to delete from all runners +# DELETE = runner you want to delete from the pool + +TOKEN= +ORG="orgs/armbian" +#ORG="user" +x=1 +while [ $x -le 51 ] # need to do it different as it can be more then 9 pages +do +RUNNER=$( +curl -L \ + -H "Accept: application/vnd.github.v3+json" \ + -H "Authorization: Bearer $TOKEN"\ + -H "X-GitHub-Api-Version: 2022-11-28" \ + "https://api.github.com/${ORG}/packages?package_type=container&page=${x}" | jq -r '.[].name' | xargs -n1 -d'\n' | sed 's/\//%2F/g' | sed -e 's/ /,/g' +) + +while IFS= read -r DATA; do + +RUNNER_ID=$(echo $DATA | cut -d"," -f1) +#RUNNER_NAME=$(echo $DATA | cut -d"," -f2) +echo $RUNNER_ID +if [[ $RUNNER_ID == cache* ]]; then +echo "PKG to remove: $RUNNER_ID" +curl -L \ + -X DELETE \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer $TOKEN"\ + -H "X-GitHub-Api-Version: 2022-11-28" \ + "https://api.github.com/${ORG}/packages/container/${RUNNER_ID}" +fi + +# deleting a runner +#if [[ $RUNNER_NAME == ${DELETE} ]]; then +#curl -L \ +# -X DELETE \ +# -H "Accept: application/vnd.github+json" \ +# -H "Authorization: Bearer ${TOKEN}"\ +# -H "X-GitHub-Api-Version: 2022-11-28" \ +# https://api.github.com/orgs/${ORG}/actions/runners/${RUNNER_ID} +#fi + +done <<< $RUNNER +x=$(( $x + 1 )) +done