guru/net-misc/gmid/files/gmid.initd
Anna Vyalkova 6a09bfd48b
net-misc/gmid: version bump to 1.6.1
also...
* include patch from the application developer to make a pidfile
* alter init.d script
* update a live ebuild

Package-Manager: Portage-3.0.18, Repoman-3.0.3
Signed-off-by: Anna Vyalkova <cyber@sysrq.in>
2021-04-27 15:17:44 +05:00

48 lines
1.1 KiB
Plaintext

#!/sbin/openrc-run
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
extra_commands="configtest"
extra_started_commands="reload"
description="Simple and secure Gemini server"
description_configtest="Run gmid's internal config check."
description_reload="Reload the gmid configuration without losing connections."
GMID_CONFIGFILE=${GMID_CONFIGFILE:-/etc/gmid/gmid.conf}
command="/usr/bin/gmid"
pidfile="/var/run/gmid.pid"
command_args="-c \"${GMID_CONFIGFILE}\" -P ${pidfile}"
depend() {
need net
use dns logger netmount
}
start_pre() {
if [ "${RC_CMD}" != "restart" ]; then
configtest || return 1
fi
}
stop_pre() {
if [ "${RC_CMD}" = "restart" ]; then
configtest || return 1
fi
}
reload() {
configtest || return 1
ebegin "Refreshing gmid's configuration"
start-stop-daemon --signal SIGHUP --pidfile "${pidfile}"
eend $? "Failed to reload gmid"
}
configtest() {
ebegin "Checking gmid's configuration"
${command} -c "${GMID_CONFIGFILE}" -n
eend $? "failed, please correct errors in the config file"
}