net-misc/bird: Init improvement for non-root usage

Package-Manager: Portage-3.0.20, Repoman-3.0.2
Signed-off-by: Alarig Le Lay <alarig@swordarmor.fr
This commit is contained in:
Alarig Le Lay 2021-08-05 16:27:40 +02:00
parent bec6b557c8
commit 1ee2322e81
Signed by: alarig
GPG key ID: 7AFE62C6DF8BCDEC

View file

@ -5,13 +5,12 @@
extra_started_commands="reload" extra_started_commands="reload"
pidfile="/run/${RC_SVCNAME}.pid" pidfile="/run/${RC_SVCNAME}/${RC_SVCNAME}.pid"
command="/usr/sbin/${RC_SVCNAME}" command="/usr/sbin/${RC_SVCNAME}"
retry=15 retry=15
start_stop_daemon_args="--make-pidfile"
CONF_FILE="/etc/${RC_SVCNAME}.conf" CONF_FILE="/etc/${RC_SVCNAME}.conf"
SOCK="/run/${RC_SVCNAME}.ctl" SOCK="/run/${RC_SVCNAME}/${RC_SVCNAME}.ctl"
if [ ${BIRD_GROUP} ]; then if [ ${BIRD_GROUP} ]; then
BIRD_OPTS="${BIRD_OPTS} -g ${BIRD_GROUP}" BIRD_OPTS="${BIRD_OPTS} -g ${BIRD_GROUP}"
@ -25,7 +24,7 @@ command_args="${client_args} -c ${CONF_FILE} -P ${pidfile} ${BIRD_OPTS}"
client_args="${client_args} -r" client_args="${client_args} -r"
depend() { depend() {
need net use net
use logger use logger
} }
@ -52,8 +51,12 @@ reload() {
eend $? eend $?
} }
start_pre() {
checkpath -d -m 0755 -o bird:bird "/run/${RC_SVCNAME}"
}
start_post() { start_post() {
checkpath -f -m 0655 -o bird:bird "${pidfile}" ln -sf "${SOCK}" /run
} }
stop_pre() { stop_pre() {