summaryrefslogtreecommitdiff
path: root/net-vpn/i2pd/files/i2pd-2.39.0.initd
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2021-09-25 20:21:45 +0100
committerV3n3RiX <venerix@redcorelinux.org>2021-09-25 20:21:45 +0100
commitc719fdcee603a5a706a45d10cb598762d56a727d (patch)
tree620cbf137661399a3fb1eff92914204f9a970713 /net-vpn/i2pd/files/i2pd-2.39.0.initd
parentcc4618c9ba3d974948ebf340b542d8cb01db2f55 (diff)
gentoo resync : 25.09.2021
Diffstat (limited to 'net-vpn/i2pd/files/i2pd-2.39.0.initd')
-rw-r--r--net-vpn/i2pd/files/i2pd-2.39.0.initd52
1 files changed, 52 insertions, 0 deletions
diff --git a/net-vpn/i2pd/files/i2pd-2.39.0.initd b/net-vpn/i2pd/files/i2pd-2.39.0.initd
new file mode 100644
index 000000000000..c5248b20cfee
--- /dev/null
+++ b/net-vpn/i2pd/files/i2pd-2.39.0.initd
@@ -0,0 +1,52 @@
+#!/sbin/openrc-run
+# Copyright 1999-2021 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+description="C++ daemon for accessing the I2P network"
+description_graceful="Graceful shutdown, takes 10 minutes"
+
+command="/usr/bin/i2pd"
+command_args="${I2PD_OPTIONS}"
+user="${I2PD_USER}:${I2PD_GROUP}"
+start_stop_daemon_args="
+ --user \"${user}\"
+ --pidfile \"${I2PD_PID}\"
+ --progress
+"
+retry="SIGTERM/20/SIGKILL/20"
+
+I2PD_PID_DIR=$(dirname "${I2PD_PID}")
+
+extra_started_commands="graceful"
+
+depend() {
+ use dns logger netmount
+}
+
+start_pre() {
+ if [ -z "${I2PD_USER}" ] || \
+ [ -z "${I2PD_GROUP}" ] || \
+ [ -z "${I2PD_PID}" ] || \
+ [ -z "${I2PD_LOG}" ] || \
+ [ -z "${I2PD_OPTIONS}" ] ; then
+ eerror "Not all variables I2PD_USER, I2PD_GROUP, I2PD_PID, I2PD_OPTIONS, I2PD_LOG are defined."
+ eerror "Check your /etc/conf.d/i2pd."
+ return 1
+ fi
+ checkpath -f -o "${user}" "${I2PD_LOG}"
+ checkpath -d -m 0750 -o "${user}" "${I2PD_PID_DIR}"
+}
+
+stop_post() {
+ # #808845
+ rm -f "${I2PD_PID}"
+}
+
+graceful() {
+ # on SIGINT, i2pd stops accepting tunnels and shuts down in 600 seconds
+ ebegin "Gracefully stopping i2pd, this takes 10 minutes"
+ mark_service_stopping
+ eval start-stop-daemon --stop ${start_stop_daemon_args} \
+ --exec "${command}" --retry 'SIGINT/620/SIGTERM/20/SIGKILL/20'
+ eend $? && mark_service_stopped
+}