Initial commit

This commit is contained in:
Marko Zajc 2026-02-21 18:30:25 +01:00
commit 7c41b4ff21
No known key found for this signature in database
GPG key ID: D763FF6BE6F2A7AA
5 changed files with 112 additions and 0 deletions

15
.SRCINFO Normal file
View file

@ -0,0 +1,15 @@
pkgbase = nginx-mod-shapow
pkgdesc = Nginx module to keep bots out with a proof-of-work challenge
pkgver = 1.0
pkgrel = 1
url = https://git.zajc.tel/shapow.git/about
arch = x86_64
license = AGPL-3.0-only
makedepends = nginx
makedepends = nginx-src
backup = etc/nginx/modules.d/19-shapow.conf
source = https://files.zajc.tel/public/builds/shapow/1.0/shapow-1.0.tar.xz
sha256sums = 254014a367e953cbe455395c783be3f8a5c514f90c7a2a7d2bf0c794d025502b
pkgname = nginx-mod-shapow
depends = nginx

12
LICENSE Normal file
View file

@ -0,0 +1,12 @@
Copyright Arch Linux Contributors
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE
FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

1
LICENSES/0BSD.txt Symbolic link
View file

@ -0,0 +1 @@
../LICENSE

59
PKGBUILD Normal file
View file

@ -0,0 +1,59 @@
# Maintainer: Marko Zajc <marko at zajc period tel>
pkgname=nginx-mod-shapow
pkgver=1.0
pkgrel=1
_modname="${pkgname#nginx-mod-}"
pkgdesc="Nginx module to keep bots out with a proof-of-work challenge"
arch=('x86_64')
makedepends=('nginx' 'nginx-src')
url="https://git.zajc.tel/shapow.git/about"
license=('AGPL-3.0-only')
source=(https://files.zajc.tel/public/builds/$_modname/$pkgver/$_modname-$pkgver.tar.xz)
sha256sums=('254014a367e953cbe455395c783be3f8a5c514f90c7a2a7d2bf0c794d025502b')
backup=('etc/nginx/modules.d/19-shapow.conf')
prepare() {
mkdir -p build
cd build
ln -sf /usr/src/nginx/auto
ln -sf /usr/src/nginx/src
sed -i 's|^#define NGX_HTTP_SHAPOW_RESOURCE_ROOT .*|#define NGX_HTTP_SHAPOW_RESOURCE_ROOT "/usr/share/'$pkgname'"|' \
"$srcdir/$_modname/src/config.h";
}
build() {
cd build
auto/configure \
--with-ld-opt="$LDFLAGS" \
--with-compat \
--add-dynamic-module=../$_modname
make modules
}
package() {
if [[ "$BUILDTOOL" == devtools ]]; then
local nginx_dep="nginx=$(nginx -v 2>&1 | sed 's|.*/||')"
depends+=($nginx_dep)
else
depends+=(nginx)
fi
install -Dm644 "$srcdir"/$_modname/README.md "$pkgdir"/usr/share/licenses/$pkgname/README.md
install -Dm644 "$srcdir"/$_modname/screenshot.png "$pkgdir"/usr/share/licenses/$pkgname/screenshot.png
install -Dm644 "$srcdir"/$_modname/resources/challenge.html "$pkgdir"/usr/share/$pkgname/challenge.html
install -Dm644 "$srcdir"/$_modname/resources/challenge.css "$pkgdir"/usr/share/$pkgname/challenge.css
install -Dm644 "$srcdir"/$_modname/resources/challenge.js "$pkgdir"/usr/share/$pkgname/challenge.js
install -Dm644 "$srcdir"/$_modname/resources/challenge-worker.js "$pkgdir"/usr/share/$pkgname/challenge-worker.js
install -dm0755 "$pkgdir"/etc/nginx/modules.d
cd build/objs
for mod in *.so; do
install -Dm755 $mod "$pkgdir"/usr/lib/nginx/modules/$mod
echo "load_module \"/usr/lib/nginx/modules/$mod\";" >> "$pkgdir/etc/nginx/modules.d/19-shapow.conf"
done
}

25
REUSE.toml Normal file
View file

@ -0,0 +1,25 @@
version = 1
[[annotations]]
path = [
"PKGBUILD",
"README.md",
"keys/**",
".SRCINFO",
".gitignore",
".nvchecker.toml",
"*.install",
"*.sysusers",
"*sysusers.conf",
"*.tmpfiles",
"*tmpfiles.conf",
"*.logrotate",
"*.pam",
"*.service",
"*.socket",
"*.timer",
"*.desktop",
"*.hook",
]
SPDX-FileCopyrightText = "Arch Linux contributors"
SPDX-License-Identifier = "0BSD"