From 8cf813ff033bbc98a7dd40db6ac11e2e35c7e997 Mon Sep 17 00:00:00 2001 From: mia Date: Sat, 8 Jun 2024 22:56:05 -0700 Subject: initial commit --- packages/searxng/.gitignore | 1 + packages/searxng/PKGBUILD | 50 +++++++++++++++++++++++++++++++++++++++ packages/searxng/searxng.hook | 9 +++++++ packages/searxng/searxng.service | 18 ++++++++++++++ packages/searxng/searxng.socket | 10 ++++++++ packages/searxng/searxng.sysusers | 1 + packages/searxng/update.sh | 15 ++++++++++++ 7 files changed, 104 insertions(+) create mode 100644 packages/searxng/.gitignore create mode 100644 packages/searxng/PKGBUILD create mode 100644 packages/searxng/searxng.hook create mode 100644 packages/searxng/searxng.service create mode 100644 packages/searxng/searxng.socket create mode 100644 packages/searxng/searxng.sysusers create mode 100755 packages/searxng/update.sh (limited to 'packages/searxng') diff --git a/packages/searxng/.gitignore b/packages/searxng/.gitignore new file mode 100644 index 0000000..274bcf0 --- /dev/null +++ b/packages/searxng/.gitignore @@ -0,0 +1 @@ +/searxng/ diff --git a/packages/searxng/PKGBUILD b/packages/searxng/PKGBUILD new file mode 100644 index 0000000..c51e1ae --- /dev/null +++ b/packages/searxng/PKGBUILD @@ -0,0 +1,50 @@ +# adapted from searxng-git 1.0.0.r3824.gac430a9ea-1 + +pkgname=searxng +_date=2024.05.31 +_commit=18fb701be +pkgver=$_date+$_commit +pkgrel=1 +pkgdesc="A privacy-respecting, hackable metasearch engine" +arch=(any) +url="https://github.com/searxng/searxng" +makedepends=(python python-setuptools) +depends=( + python-async-timeout + python-babel + python-brotli + python-certifi + python-dateutil + python-fasttext-predict + python-flask + python-flask-babel + python-h2 + python-httpx + python-httpx-socks + python-jinja + python-lxml + python-markdown-it-py + python-pygments + python-pytomlpp + python-redis + python-setproctitle + python-uvloop + python-yaml + gunicorn +) +source=("git+$url#commit=$_commit" searxng.sysusers searxng.service searxng.socket) +sha256sums=(SKIP SKIP SKIP SKIP) + +package() { + cd "$srcdir/searxng" + local _site_packages="$(python -c 'import site; print(site.getsitepackages()[0])')" + + python setup.py install --root="$pkgdir" --optimize=1 + python -m searx.version freeze + + install -Dm644 "$srcdir/searxng.sysusers" "$pkgdir/usr/lib/sysusers.d/searxng.conf" + install -Dm644 "$srcdir/searxng/searx/version_frozen.py" "$pkgdir$_site_packages/searx/version_frozen.py" + install -Dm644 "$srcdir/searxng/LICENSE" "$pkgdir/usr/share/licenses/searxng/LICENSE" + install -Dm644 "$srcdir/searxng.service" "$pkgdir/usr/lib/systemd/system/searxng.service" + install -Dm644 "$srcdir/searxng.socket" "$pkgdir/usr/lib/systemd/system/searxng.socket" +} diff --git a/packages/searxng/searxng.hook b/packages/searxng/searxng.hook new file mode 100644 index 0000000..6a99f07 --- /dev/null +++ b/packages/searxng/searxng.hook @@ -0,0 +1,9 @@ +[Trigger] +Type = Package +Operation = Upgrade +Target = searxng + +[Action] +Description = Restarting searxng daemon... +When = PostTransaction +Exec = /bin/bash -c '/usr/bin/systemctl is-active searxng.service -q && /usr/bin/systemctl restart searxng.service || /usr/bin/true' diff --git a/packages/searxng/searxng.service b/packages/searxng/searxng.service new file mode 100644 index 0000000..604df1c --- /dev/null +++ b/packages/searxng/searxng.service @@ -0,0 +1,18 @@ +[Unit] +Description=searxng daemon +Requires=searxng.socket +After=network.target + +[Service] +Type=notify +User=searxng +Group=searxng +RuntimeDirectory=searxng +ExecStart=/usr/bin/gunicorn searx.webapp +ExecReload=/bin/kill -s HUP $MAINPID +KillMode=mixed +TimeoutStopSec=5 +PrivateTmp=true + +[Install] +WantedBy=multi-user.target diff --git a/packages/searxng/searxng.socket b/packages/searxng/searxng.socket new file mode 100644 index 0000000..a599564 --- /dev/null +++ b/packages/searxng/searxng.socket @@ -0,0 +1,10 @@ +[Unit] +Description=searxng socket + +[Socket] +ListenStream=/run/searxng.sock +SocketUser=http +SocketMode=600 + +[Install] +WantedBy=sockets.target diff --git a/packages/searxng/searxng.sysusers b/packages/searxng/searxng.sysusers new file mode 100644 index 0000000..025903c --- /dev/null +++ b/packages/searxng/searxng.sysusers @@ -0,0 +1 @@ +u searxng - "Searxng server user" diff --git a/packages/searxng/update.sh b/packages/searxng/update.sh new file mode 100755 index 0000000..a4d3bde --- /dev/null +++ b/packages/searxng/update.sh @@ -0,0 +1,15 @@ +#!/bin/bash +set -e + +pushd packages/searxng >/dev/null +pushd searxng >/dev/null +git fetch +date=$(git show -s --date=format:%Y.%m.%d --format=%cd) +commit=$(git show -s --format=%h) +popd >/dev/null +sed -i "s/_date=.*/_date=$date/" PKGBUILD +sed -i "s/_commit=.*/_commit=$commit/" PKGBUILD +popd >/dev/null + +echo rebuilding +python packages/local.py searxng -- cgit 1.4.1