From 5d422846d205d1e41cc113f53d5627100e3e7e54 Mon Sep 17 00:00:00 2001 From: "Anna (cybertailor) Vyalkova" Date: Tue, 9 Apr 2024 10:21:55 +0500 Subject: [PATCH] net-im/eturnal: add new openrc init file "eturnalctl daemon" is very unreliable, and also I forgot slot operator on Erlang. Signed-off-by: Anna (cybertailor) Vyalkova --- ...1.12.0.ebuild => eturnal-1.12.0-r1.ebuild} | 5 +- net-im/eturnal/files/eturnal.initd | 46 +++++++++++++++++++ 2 files changed, 48 insertions(+), 3 deletions(-) rename net-im/eturnal/{eturnal-1.12.0.ebuild => eturnal-1.12.0-r1.ebuild} (94%) create mode 100644 net-im/eturnal/files/eturnal.initd diff --git a/net-im/eturnal/eturnal-1.12.0.ebuild b/net-im/eturnal/eturnal-1.12.0-r1.ebuild similarity index 94% rename from net-im/eturnal/eturnal-1.12.0.ebuild rename to net-im/eturnal/eturnal-1.12.0-r1.ebuild index 15affd64f8..acb6aa0f5d 100644 --- a/net-im/eturnal/eturnal-1.12.0.ebuild +++ b/net-im/eturnal/eturnal-1.12.0-r1.ebuild @@ -18,7 +18,7 @@ KEYWORDS="~amd64" DEPEND=" acct-user/eturnal - >=dev-lang/erlang-21[ssl] + >=dev-lang/erlang-21:=[ssl] dev-libs/libyaml dev-libs/openssl:= >=dev-erlang/conf-0.1 @@ -42,7 +42,6 @@ src_configure() { export CODE_LOADING=dynamic export SKIP_DEPS=true - rebar3_src_configure } @@ -51,7 +50,7 @@ rebar3_install_release() { cp -pR bin lib releases "${ED}"/opt/eturnal/ || die systemd_dounit etc/systemd/system/eturnal.service - newinitd etc/openrc/eturnal.initd eturnal + newinitd "${FILESDIR}"/eturnal.initd eturnal newconfd etc/openrc/eturnal.confd eturnal insinto /etc diff --git a/net-im/eturnal/files/eturnal.initd b/net-im/eturnal/files/eturnal.initd new file mode 100644 index 0000000000..5d567d5a2b --- /dev/null +++ b/net-im/eturnal/files/eturnal.initd @@ -0,0 +1,46 @@ +#!/sbin/openrc-run +# shellcheck shell=sh +# +# Copyright 2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +extra_started_commands="reload" +command="/usr/sbin/eturnalctl" +command_args="foreground" +command_user="eturnal:turnserver" +command_background=1 +pidfile="/run/eturnal.pid" +capabilities="^cap_net_bind_service" +healthcheck_delay=300 +healthcheck_timer=60 + +depend() { + need epmd net + after firewall +} + +healthcheck() { + "${command}" ping >/dev/null +} + +start_post() { + local i=10 + while [ $((i = i - 1)) -gt 0 ]; do + healthcheck && return 0 + sleep 1 + done + + return 1 +} + +stop() { + ebegin "Stopping ${RC_SVCNAME}" + "${command}" stop + eend $? +} + +reload() { + ebegin "Reloading ${RC_SVCNAME}" + "${command}" reload + eend $? +}