install dendrite to /usr/, add service and postinst

This commit is contained in:
leafee98 2023-12-13 16:37:27 +08:00
parent f3ca37573a
commit 0345418039
2 changed files with 35 additions and 1 deletions

View file

@ -10,6 +10,7 @@ maintainer="Leafee98 <me@leafee98.com>"
source=( source=(
"dendrite::git+https://github.com/matrix-org/dendrite.git#tag=v${pkgver}" "dendrite::git+https://github.com/matrix-org/dendrite.git#tag=v${pkgver}"
"dendrite.service::materials/dendrite.service"
) )
function build { function build {
@ -22,8 +23,23 @@ function build {
function package { function package {
for f in ${srcdir}/dendrite/bin/* for f in ${srcdir}/dendrite/bin/*
do do
install -Dm755 -t "${pkgdir}/usr/local/lib/dendrite/" "$f"; install -Dm755 -t "${pkgdir}/usr/lib/dendrite/" "$f";
done done
install -Dm644 "${srcdir}/dendrite/dendrite-sample.yaml" "${pkgdir}/etc/dendrite/dendrite-sample.yaml" install -Dm644 "${srcdir}/dendrite/dendrite-sample.yaml" "${pkgdir}/etc/dendrite/dendrite-sample.yaml"
install -Dm755 "${srcdir}/dendrite.service" "${pkgdir}/usr/lib/systemd/system/dendrite.service"
}
function debian_postinst {
cat << 'EOF'
#!/usr/bin/env bash
adduser --system dendrite
systemctl daemon-reload
if systemctl is-active --quiet dendrite.service ; then
systemctl restart dendrite.service
fi
EOF
} }

View file

@ -0,0 +1,18 @@
[Unit]
Description=matrix home server
After=network.target
After=postgresql.service
After=nats-server.service
[Service]
Type=simple
User=dendrite
Group=dendrite
ExecStart=/usr/lib/dendrite/dendrite -config /etc/dendrite/dendrite.yaml -http-bind-address 127.0.0.1:8008
Restart=on-failure
RestartSec=5s
LimitNOFILE=65535
MemoryMax=3072M
[Install]
WantedBy=multi-user.target