🗝
summary refs log tree commit diff
path: root/packages/searxng
diff options
context:
space:
mode:
authormia <mia@mia.jetzt>2024-06-08 22:56:05 -0700
committermia <mia@mia.jetzt>2024-06-08 22:56:05 -0700
commit8cf813ff033bbc98a7dd40db6ac11e2e35c7e997 (patch)
treea451059194cbd4ba90993ebdaced4749448ec4df /packages/searxng
downloadasylum-8cf813ff033bbc98a7dd40db6ac11e2e35c7e997.tar.gz
asylum-8cf813ff033bbc98a7dd40db6ac11e2e35c7e997.zip
initial commit
Diffstat (limited to 'packages/searxng')
-rw-r--r--packages/searxng/.gitignore1
-rw-r--r--packages/searxng/PKGBUILD50
-rw-r--r--packages/searxng/searxng.hook9
-rw-r--r--packages/searxng/searxng.service18
-rw-r--r--packages/searxng/searxng.socket10
-rw-r--r--packages/searxng/searxng.sysusers1
-rwxr-xr-xpackages/searxng/update.sh15
7 files changed, 104 insertions, 0 deletions
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