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 <cyber+gentoo@sysrq.in>
This commit is contained in:
Anna (cybertailor) Vyalkova 2024-04-09 10:21:55 +05:00
parent a31e7776e5
commit 5d422846d2
No known key found for this signature in database
GPG Key ID: E7B76EDC50864BB1
2 changed files with 48 additions and 3 deletions

View File

@ -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

View File

@ -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 $?
}