From 58369eb912aced6aa4a9debc8057675cc64cc427 Mon Sep 17 00:00:00 2001 From: "Ward Nakchbandi (Cosmic Fusion)" <83735213+CosmicFusion@users.noreply.github.com> Date: Sun, 27 Aug 2023 20:12:06 +0300 Subject: [PATCH] --- .github/workflows/external-winehq.yml | 46 +++++++++++++++++++++++++++ external-winehq.sh | 43 +++++++++++++++++++++++-- 2 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/external-winehq.yml diff --git a/.github/workflows/external-winehq.yml b/.github/workflows/external-winehq.yml new file mode 100644 index 0000000..d42b333 --- /dev/null +++ b/.github/workflows/external-winehq.yml @@ -0,0 +1,46 @@ +name: PikaOS WineHQ Repo Sync (External) + +on: + workflow_dispatch: + schedule: + - cron: '0 0 * * *' + +jobs: + build: + runs-on: self-hosted + container: + image: ghcr.io/pikaos-linux/pika-package-container:latest + volumes: + - /proc:/proc + options: --privileged -it + + steps: + - uses: actions/checkout@v3 + + - name: Import GPG key + id: import_gpg + uses: crazy-max/ghaction-import-gpg@v5 + with: + gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} + passphrase: ${{ secrets.PASSPHRASE }} + + - name: Install SSH key + uses: shimataro/ssh-key-action@v2 + with: + key: ${{ secrets.SSH_KEY }} + name: id_rsa + known_hosts: ${{ secrets.KNOWN_HOSTS }} + if_key_exists: replace + + - name: Sync Repository + run: chmod +x ./external-winehq.sh && ./external-winehq.sh + + - name: Purge cache + uses: jakejarvis/cloudflare-purge-action@master + env: + # Zone is required by both authentication methods + CLOUDFLARE_ZONE: ${{ secrets.CLOUDFLARE_ZONE }} + + CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }} + PURGE_URLS: ${{ vars.PURGE_URLS }} + diff --git a/external-winehq.sh b/external-winehq.sh index e284013..c922361 100644 --- a/external-winehq.sh +++ b/external-winehq.sh @@ -19,8 +19,47 @@ rm -rf /etc/apt/preferences.d/*pika* # Get Extranal WineHQ pool echo 'deb [trusted=yes] https://dl.winehq.org/wine-builds/ubuntu lunar main' | sudo tee /etc/apt/sources.list.d/external.list +apt update -y -PPP32=$(../../ppp https://ppa.pika-os.com/dists/lunar/external/binary-i386/Packages https://dl.winehq.org/wine-builds/ubuntu/dists/lunar/main/binary-i386/Packages) +# Get i386 packages list +wget https://dl.winehq.org/wine-builds/ubuntu/dists/lunar/main/binary-i386/Packages -o i386-wine-pkg +PKG_I386=$(cat i386-wine-pkg | grep "Package: " | awk '{print $2}' | sort -u ) +touch ppp32.list +for i in $(cat $PKG_I386) +do + touch /etc/apt/preferences.d/0-external-sync.conf + echo 'Package': * > /etc/apt/preferences.d/0-external-sync.conf + echo 'Pin: release o=ppa.pika-os.com' >> /etc/apt/preferences.d/0-external-sync.conf + echo 'Pin-Priority: 1000' >> /etc/apt/preferences.d/0-external-sync.conf + apt-cache show $i | grep 'Version:' | cut -d":" -f2 | head -n1 | sed 's/ //g' > $i-pika-i386 + rm -rf /etc/apt/preferences.d/0-external-sync.conf + apt-cache show $i | grep 'Version:' | cut -d":" -f2 | head -n1 | sed 's/ //g' > $i-external-i386 + if [[ $(cat $i-pika-i386) == $(cat $i-external-i386) ]] + then + echo $i >> ppp32.list + fi +done + +# Get amd64 packages list +wget https://dl.winehq.org/wine-builds/ubuntu/dists/lunar/main/binary-amd64/Packages -o amd64-wine-pkg +PKG_AMD64=$(cat amd64-wine-pkg | grep "Package: " | awk '{print $2}' | sort -u ) +touch ppp64.list +for i in $(cat $PKG_AMD64) +do + touch /etc/apt/preferences.d/0-external-sync.conf + echo 'Package': * > /etc/apt/preferences.d/0-external-sync.conf + echo 'Pin: release o=ppa.pika-os.com' >> /etc/apt/preferences.d/0-external-sync.conf + echo 'Pin-Priority: 1000' >> /etc/apt/preferences.d/0-external-sync.conf + apt-cache show $i | grep 'Version:' | cut -d":" -f2 | head -n1 | sed 's/ //g' > $i-pika-amd64 + rm -rf /etc/apt/preferences.d/0-external-sync.conf + apt-cache show $i | grep 'Version:' | cut -d":" -f2 | head -n1 | sed 's/ //g' > $i-external-amd64 + if [[ $(cat $i-pika-amd64) == $(cat $i-external-amd64) ]] + then + echo $i >> ppp64.list + fi +done + +PPP32=$(cat ppp32.list | tr '\n' ' ') if [ ! -z "$PPP32" ] then dpkg --add-architecture i386 @@ -31,7 +70,7 @@ else echo "i386 Repos are synced" fi -PPP64=$(../../ppp https://ppa.pika-os.com/dists/lunar/external/binary-amd64/Packages https://dl.winehq.org/wine-builds/ubuntu/dists/lunar/main/binary-amd64/Packages) +PPP64=$(cat ppp64.list | tr '\n' ' ') if [ ! -z "$PPP64" ] then apt update -o APT::Architecture="amd64" -o APT::Architectures="amd64" -y --allow-unauthenticated