summaryrefslogtreecommitdiff
path: root/net-misc/exabgp/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2021-12-05 02:47:11 +0000
committerV3n3RiX <venerix@koprulu.sector>2021-12-05 02:47:11 +0000
commit2771f79232c273bc2a57d23bf335dd81ccf6af28 (patch)
treec8af0fd04194aed03cf067d44e53c7edd3e9ab84 /net-misc/exabgp/files
parente9d044d4b9b71200a96adfa280848858c0f468c9 (diff)
gentoo resync : 05.12.2021
Diffstat (limited to 'net-misc/exabgp/files')
-rw-r--r--net-misc/exabgp/files/exabgp.initd-r264
1 files changed, 64 insertions, 0 deletions
diff --git a/net-misc/exabgp/files/exabgp.initd-r2 b/net-misc/exabgp/files/exabgp.initd-r2
new file mode 100644
index 000000000000..30280b9cfbf7
--- /dev/null
+++ b/net-misc/exabgp/files/exabgp.initd-r2
@@ -0,0 +1,64 @@
+#!/sbin/openrc-run
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# default arguments
+: "${EXABGP_ARGS:=--env=/etc/${RC_SVCNAME}/exabgp.env /etc/${RC_SVCNAME}/exabgp.conf}"
+
+command="capsh"
+command_args="
+ --groups=${EXABGP_GROUP:=exabgp}
+ --user=${EXABGP_USER:=exabgp}
+ --caps='cap_net_admin+epi cap_setuid+ep-i cap_setgid+ep-i'
+ -- -c \"/usr/bin/exabgp ${EXABGP_ARGS}\""
+
+supervisor=supervise-daemon
+
+: "${pidfile:=/run/exabgp/${RC_SVCNAME}-supervisor.pid}"
+: "${output_log:=/var/log/${RC_SVCNAME}/exabgp.log}"
+: "${error_log:=/var/log/${RC_SVCNAME}/exabgp.log}"
+
+extra_started_commands="routes sessions"
+extra_commands="checkconfig"
+
+depend() {
+ need net
+}
+
+start_pre() {
+ checkpath -q -d -m 0755 -o "${EXABGP_USER}:${EXABGP_GROUP}" \
+ /run/exabgp || return
+
+ checkpath -q -p -m 0600 -o "${EXABGP_USER}:${EXABGP_GROUP}" \
+ /run/exabgp/${RC_SVCNAME}.in /run/exabgp/${RC_SVCNAME}.out || return
+
+ checkpath -q -d -m 0755 -o "${EXABGP_USER}:${EXABGP_GROUP}" \
+ "/var/log/${RC_SVCNAME}" || return
+
+ checkconfig || return
+}
+
+stop_pre() {
+ # don't restart if the configuration is bad
+ if [ "${RC_CMD}" = restart ]; then
+ checkconfig || return
+ fi
+}
+
+checkconfig() {
+ ebegin "Checking configuration for ${RC_SVCNAME}"
+ exabgp -t ${EXABGP_ARGS}
+ eend ${?} "Invalid configuration"
+}
+
+sessions() {
+ ebegin "Querying sessions"
+ exabgpcli --env /etc/${RC_SVCNAME}/exabgp.env show neighbor summary
+ eend ${?} "exabgpcli failed"
+}
+
+routes() {
+ ebegin "Querying routes"
+ exabgpcli --env /etc/${RC_SVCNAME}/exabgp.env show adj-rib out
+ eend ${?} "exabgpcli failed"
+}