Skip to content

Commit

Permalink
package wg-netns
Browse files Browse the repository at this point in the history
  • Loading branch information
glynx committed Apr 3, 2024
1 parent 88103cf commit a79ec21
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ jobs:
- package-subfinder
- package-tlsx
- package-trevorspray
- package-wg-netns
concurrency: ci-${{ github.ref }}
steps:
- name: Checkout
Expand Down Expand Up @@ -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
32 changes: 32 additions & 0 deletions wg-netns/PKGBUILD
Original file line number Diff line number Diff line change
@@ -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 <<EOF >"${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)"
}

0 comments on commit a79ec21

Please sign in to comment.