blob: c58dcfcb575be876038add1e682f461090342bd0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
#!/sbin/openrc-run
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
name="Invisible Internet Protocol daemon"
description="C++ daemon for accessing the I2P network"
command="/usr/bin/i2pd"
pidfile="/run/i2pd/i2pd.pid"
command_args_background="--daemon --pidfile=${pidfile}"
command_progress=1
command_user="${I2PD_USER:=i2pd}:${I2PD_GROUP:=i2pd}"
retry="SIGTERM/30/SIGKILL/10"
required_dirs="/var/lib/i2pd"
required_files="/etc/i2pd/i2pd.conf"
I2PD_LOGFILE="${I2PD_LOGFILE:=/var/log/i2pd.log}"
command_args="--service --log=file \
--conf=/etc/i2pd/i2pd.conf \
--tunconf=/etc/i2pd/tunnels.conf \
--tunnelsdir=/etc/i2pd/tunnels.conf.d \
--loglevel='${I2PD_LOGLEVEL:=warn}'\
--logfile=${I2PD_LOGFILE} ${I2PD_ARGS} \
"
depend() {
use dns # for bootstrapping
use logger
}
start_pre() {
checkpath -o ${command_user} -d $(dirname ${pidfile})
checkpath -o ${command_user} -f ${I2PD_LOGFILE}
}
extra_started_commands="reload graceful"
description_reload="Reload tunnels.conf configuration"
reload() {
start-stop-daemon -s HUP -x ${command} -p ${pidfile}
eend $? "Reloaded tunnels configuration"
}
description_graceful="Graceful shutdown, takes 10 minutes"
graceful() {
# on SIGINT, i2pd stops accepting tunnels and shuts down in 10 minutes
ebegin "Gracefully stopping i2pd, this takes 10 minutes"
mark_service_stopping
start-stop-daemon -K -x ${command} -p ${pidfile} -R "SIGINT/620/${retry}"
eend $? && mark_service_stopped
}
|