From a79ec21a6f1192b6bea2913f2e5f9e07ec0c0f3a Mon Sep 17 00:00:00 2001 From: Glynx <152297+glynx@users.noreply.github.com> Date: Wed, 3 Apr 2024 20:51:40 +0200 Subject: [PATCH] package wg-netns --- .github/workflows/ci.yaml | 19 +++++++++++++++++++ wg-netns/PKGBUILD | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 wg-netns/PKGBUILD diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8abede45..f95c9cbe 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -84,6 +84,7 @@ jobs: - package-subfinder - package-tlsx - package-trevorspray + - package-wg-netns concurrency: ci-${{ github.ref }} steps: - name: Checkout @@ -1184,3 +1185,21 @@ jobs: path: ./trevorspray/*.pkg.tar.zst retention-days: 1 if-no-files-found: error + package-wg-netns: + runs-on: ubuntu-20.04 + needs: + - build-container + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Build package + run: ./build-package.sh wg-netns + - name: Upload package + uses: actions/upload-artifact@v3 + with: + name: package-wg-netns + path: ./wg-netns/*.pkg.tar.zst + retention-days: 1 + if-no-files-found: error diff --git a/wg-netns/PKGBUILD b/wg-netns/PKGBUILD new file mode 100644 index 00000000..c9083bf6 --- /dev/null +++ b/wg-netns/PKGBUILD @@ -0,0 +1,32 @@ +pkgname=wg-netns +pkgver=latest +pkgrel=1 +url="https://github.com/dadevel/${pkgname}.git" +arch=(any) +license=(MIT) +depends=(python) +source=("git+${url}") +sha256sums=(SKIP) + +package() { + cd "${srcdir}/${pkgname}" + mkdir -p "${pkgdir}"/opt/archpkgs/bin "${pkgdir}/opt/archpkgs/${pkgname}" + python -m venv "${pkgdir}/opt/archpkgs/${pkgname}" + declare -x VIRTUAL_ENV="${pkgdir}/opt/archpkgs/${pkgname}" PYTHONPATH="${pkgdir}/opt/archpkgs/${pkgname}" PATH="${pkgdir}/opt/archpkgs/${pkgname}/bin:$PATH" + pip install . + cat <"${pkgdir}/opt/archpkgs/bin/${pkgname}" +#!/bin/sh +set -eu +export VIRTUAL_ENV=/opt/archpkgs/${pkgname} PYTHONPATH=/opt/archpkgs/${pkgname} PATH="/opt/archpkgs/${pkgname}/bin:\$PATH" +exec python /opt/archpkgs/${pkgname}/bin/wg-netns "\$@" +EOF + chmod +x "${pkgdir}/opt/archpkgs/bin/${pkgname}" + sed -i -e "s/=wg-netns/=\/opt\/archpkgs\/bin\/wg-netns/" ./extras/wg-netns@.service + install -Dm644 ./extras/wg-netns@.service "${pkgdir}/etc/systemd/system/wg-netns@.service" + install -Dm755 ./extras/netns-publish.sh "${pkgdir}/opt/archpkgs/bin/netns-publish" +} + +pkgver() { + cd "${srcdir}/${pkgname}" + echo "$(git rev-list --count HEAD).$(git rev-parse --short HEAD)" +}