diff --git a/www-apps/up-common-proxies/files/up-common-proxies.initd b/www-apps/up-common-proxies/files/up-common-proxies.initd index 26e48af..d4cee0f 100644 --- a/www-apps/up-common-proxies/files/up-common-proxies.initd +++ b/www-apps/up-common-proxies/files/up-common-proxies.initd @@ -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" diff --git a/www-apps/up-common-proxies/up-common-proxies-1.1.1.ebuild b/www-apps/up-common-proxies/up-common-proxies-1.1.1.ebuild index 10fe692..67df228 100644 --- a/www-apps/up-common-proxies/up-common-proxies-1.1.1.ebuild +++ b/www-apps/up-common-proxies/up-common-proxies-1.1.1.ebuild @@ -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