www-apps/up-common-proxies: Add systemd support
continuous-integration/drone/push Build encountered an error Details

This commit is contained in:
tastytea 2021-12-15 19:33:19 +01:00
parent 789962e459
commit 57454b1bc3
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
2 changed files with 20 additions and 4 deletions

View File

@ -3,12 +3,13 @@
# Distributed under the terms of the GNU General Public License v2
name="up-common-proxies"
description="UnifiedPush common proxies (bin)"
description="Rewrite Proxy for some UnifiedPush providers"
command="/usr/bin/up-rewrite"
pidfile="/run/${name}.pid"
logdir="/var/log/${name}"
command_background="yes"
command_user="gotify:gotify"
directory="/etc/${name}"
error_log="${logdir}/${name}.log"
command_args="-c /etc/${name}/config.toml"

View File

@ -3,7 +3,7 @@
EAPI=8
inherit go-module
inherit go-module systemd
DESCRIPTION="Rewrite proxy for UnifiedPush"
HOMEPAGE="https://github.com/UnifiedPush/common-proxies"
@ -66,11 +66,25 @@ S="${WORKDIR}/${PN/up-/}-${PV}"
LICENSE="BSD-2 MIT"
SLOT="0"
KEYWORDS="~amd64"
IUSE="logrotate"
IUSE="logrotate systemd"
RDEPEND="acct-user/gotify"
DEPEND="${RDEPEND}"
src_prepare() {
sed -i -e "s|^WorkingDirectory=.*|WorkingDirectory=/etc/${PN}|" \
-e 's|^ExecStart=.*|ExecStart=/usr/bin/up-rewrite-proxy|' \
up-rewrite-proxy.service || die
cp "${FILESDIR}/${PN}.logrotate" . || die
if use systemd; then
sed -Ei "s/^(\s*)rc-service.*/\1systemctl restart ${PN}.service/" \
${PN}.logrotate || die
fi
default
}
src_compile() {
emake local
}
@ -80,10 +94,11 @@ src_install() {
dodoc docs/{config.md,reverse_proxy.md}
newinitd "${FILESDIR}/${PN}.initd" ${PN}
systemd_newunit up-rewrite-proxy.service ${PN}.service
if use logrotate; then
insinto etc/logrotate.d
newins "${FILESDIR}/${PN}.logrotate" "${PN}"
newins ${PN}.logrotate "${PN}"
fi
diropts --owner=gotify --group=gotify --mode=750